Thanks for the great explanation! I had reached an almost the target menu by modify all of SmalltalkEditor, TClassDescription and AbstractNautilusUI classes methods.
To be honest I'm newbie and this pragma thing seems foreign between the other pleasant experiences with smalltaking, and kind of hindrance for the exploratory nature of normal smalltalk code browsing. Regards, Ala'a On Wed, Mar 23, 2016 at 2:05 AM, Nicolai Hess <nicolaih...@gmail.com> wrote: > > > 2016-03-22 22:27 GMT+01:00 Ala'a Mohammad <amal...@gmail.com>: >> >> Hi, >> >> I'm trying to modify the context menu of the code editor through >> modification to SmalltalkEditor class >> smalltalkEditorMenuOn: > > > Hi Ala'a > >> >> >> testing the modification with >> (PragmaMenuBuilder pragmaKeyword: 'smalltalkEditorMenu' model: nil) >> menu popUpInWorld > > > The context menu for Nautilus code pane works a bit different. > Can you test if your modifications are working in Workspace (or the > workspace are in a basic > inspector). > >> >> >> succeeds, and shows the final shape of the menu that I want (photo >> attached), but the actual one used by the system is messed up! (photo >> attached) >> >> I tried also to execute TextEditor class >> initialize, but that did not >> help. >> >> Another thing I did was trying to find senders and references to the >> SmalltalkEditor class >> smalltalkEditorMenuOn, and find none! (So who >> is calling that with a 'aBuilder'?), and the only implementation of it >> is the one I'm trying to update (more confusion - pardon the puzzled >> newbie). > > > The smalltalkEditorMenuOn: method, containing the smalltalkEditorMenu-Pragma > is not > called explicit. Instead, there is a Method SmalltalkEditor class >> > smalltalkEditorMenuKeyword > that returns the pragma name ('smalltalkEditorMenu') used to collect all > methods using this pragma > for defining the menus. > > For Nautilus, there is another step involved. First it calls > SmalltalkEditor yellowButtonMenu > this will ask for the pragma (SmalltalkEditor class >> > smalltalkEditorMenuKeyword) and builds a menu > from every method using this pragma (here only the method SmalltalkEditor > class >> smalltalkEditorMenuOn: ). > NOW it modifies this menu and adds (from all methods using the pragma > <nautilusGlobalSourceCodeMenu> and reorganize some more entries (this is > ugly, yes). > >> >> >> Attached are the photos for the original menu, target menu and the >> messed up menu. >> >> I'm using Pharo 4.0 from the official download for Linux from Pharo.org. >> >> my system is the following: >> Linuxmint 17.1 Rebecca >> 3.13.0-37-generic #64-Ubuntu SMP >> >> What I'm doing wrong? and/or what I'm missing? >> >> Thanks in advance for the help. >> >> Regards, >> >> Ala'a > >