Hi,
I'm trying to modify the context menu of the code editor through modification to SmalltalkEditor class >> smalltalkEditorMenuOn: testing the modification with (PragmaMenuBuilder pragmaKeyword: 'smalltalkEditorMenu' model: nil) menu popUpInWorld 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). 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 messedup-menu.png (38K) Download Attachment original-menu.png (32K) Download Attachment target-menu.png (16K) Download Attachment |
2016-03-22 22:27 GMT+01:00 Ala'a Mohammad <[hidden email]>: Hi, Hi Ala'a
Can you test if your modifications are working in Workspace (or the workspace are in a basic inspector).
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).
|
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 <[hidden email]> wrote: > > > 2016-03-22 22:27 GMT+01:00 Ala'a Mohammad <[hidden email]>: >> >> 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 > > |
you are not the only one, I have been coding 2 years now with Pharo , pragmas still look as the most non smalltalky things as the first time I discovered them. On Wed, Mar 23, 2016 at 10:58 PM Ala'a Mohammad <[hidden email]> wrote: Thanks for the great explanation! |
I am glad I am not the only one with a
deep dislike for Pragmas ;-)
Am 24.03.16 um 09:54 schrieb Dimitris Chloupis:
-- ----------------------------------------------------------------------- Objektfabrik Joachim Tuchel [hidden email] Fliederweg 1 http://www.objektfabrik.de D-71640 Ludwigsburg http://joachimtuchel.wordpress.com Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1 |
Free forum by Nabble | Edit this page |