How pragma works to create menu?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How pragma works to create menu?

Mark Rizun
In the NautilusRefactoring class we have a method on a class side:

sourceCodeRefactoringMenu: aBuilder
        <nautilusGlobalSourceCodeMenu>
        | target |
        target := aBuilder model.
        target selectedClass ifNotNil: [:selectedClass | selectedClass sourceCodeRefactoring: aBuilder ]

I'd like to understand how this line works: target := aBuilder model. I mean, how aBuilder initializes a model?
Because, if you change the pragma from <nautilusGlobalSourceCodeMenu> to another one, you will get another result using this particular line.

Mark
Reply | Threaded
Open this post in threaded view
|

Re: How pragma works to create menu?

Nicolai Hess
2014-07-10 15:45 GMT+02:00 Mark Rizun <[hidden email]>:
In the NautilusRefactoring class we have a method on a class side:

sourceCodeRefactoringMenu: aBuilder
        <nautilusGlobalSourceCodeMenu>
        | target |
        target := aBuilder model.
        target selectedClass ifNotNil: [:selectedClass | selectedClass
sourceCodeRefactoring: aBuilder ]

I'd like to understand how this line works: target := aBuilder model. I
mean, how aBuilder initializes a model?
Because, if you change the pragma from <nautilusGlobalSourceCodeMenu> to
another one, you will get another result using this particular line.

Mark


aBuilder is constructed from a PragmaMenuBuilder, this PragmaMenubuilder calls all methods with
pragma <nautilusGlobalSourceCodeMenu>.

The model is initializes in for example, in AbstractNautilusUI classMenuBuilder.


Nicolai



 


--
View this message in context: http://forum.world.st/How-pragma-works-to-create-menu-tp4767409.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: How pragma works to create menu?

Mark Rizun
Ok, thanks)


2014-07-10 16:21 GMT+02:00 Nicolai Hess <[hidden email]>:
2014-07-10 15:45 GMT+02:00 Mark Rizun <[hidden email]>:

In the NautilusRefactoring class we have a method on a class side:

sourceCodeRefactoringMenu: aBuilder
        <nautilusGlobalSourceCodeMenu>
        | target |
        target := aBuilder model.
        target selectedClass ifNotNil: [:selectedClass | selectedClass
sourceCodeRefactoring: aBuilder ]

I'd like to understand how this line works: target := aBuilder model. I
mean, how aBuilder initializes a model?
Because, if you change the pragma from <nautilusGlobalSourceCodeMenu> to
another one, you will get another result using this particular line.

Mark


aBuilder is constructed from a PragmaMenuBuilder, this PragmaMenubuilder calls all methods with
pragma <nautilusGlobalSourceCodeMenu>.

The model is initializes in for example, in AbstractNautilusUI classMenuBuilder.


Nicolai



 


--
View this message in context: http://forum.world.st/How-pragma-works-to-create-menu-tp4767409.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Reply | Threaded
Open this post in threaded view
|

Re: How pragma works to create menu?

Mark Rizun
Maybe someone knows, how can I implement a context menu for MessageBrowser that would pop-up not on itemsList pane, but on sourceCode pane. Plus, I want it to use the standart one(I mean smalltalkEditorMenu), and to have additional features.

Mark


2014-07-10 16:28 GMT+02:00 Mark Rizun <[hidden email]>:
Ok, thanks)


2014-07-10 16:21 GMT+02:00 Nicolai Hess <[hidden email]>:

2014-07-10 15:45 GMT+02:00 Mark Rizun <[hidden email]>:

In the NautilusRefactoring class we have a method on a class side:

sourceCodeRefactoringMenu: aBuilder
        <nautilusGlobalSourceCodeMenu>
        | target |
        target := aBuilder model.
        target selectedClass ifNotNil: [:selectedClass | selectedClass
sourceCodeRefactoring: aBuilder ]

I'd like to understand how this line works: target := aBuilder model. I
mean, how aBuilder initializes a model?
Because, if you change the pragma from <nautilusGlobalSourceCodeMenu> to
another one, you will get another result using this particular line.

Mark


aBuilder is constructed from a PragmaMenuBuilder, this PragmaMenubuilder calls all methods with
pragma <nautilusGlobalSourceCodeMenu>.

The model is initializes in for example, in AbstractNautilusUI classMenuBuilder.


Nicolai



 


--
View this message in context: http://forum.world.st/How-pragma-works-to-create-menu-tp4767409.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.




Reply | Threaded
Open this post in threaded view
|

Re: How pragma works to create menu?

Goubier Thierry
Hi Mark,

you can override the standard menu by creating the text view with
on:text:accept:readSelection:menu: and pass a menu building selector
as the last argument. But you may not be able to recover the default
menu that way (I didn't try, but maybe this is possible).

In the menu building selector, you can add items to the menu just the
way you want it; you can also contextualise it (based on what is
selected in the message list, for example).

Side note: to sort of get what you're doing, I got rid of the message
browser a while ago and replaced it with a system browser scoped by a
set of methods... no more special "message list" gui, just the normal
system browser gui with all power (code navigation, refactorings, smart
suggestions, contextualized menus, etc...).

Thierry

Le 10/07/2014 17:27, Mark Rizun a écrit :

> Maybe someone knows, how can I implement a context menu for
> MessageBrowser that would pop-up not on itemsList pane, but on
> sourceCode pane. Plus, I want it to use the standart one(I mean
> smalltalkEditorMenu), and to have additional features.
>
> Mark
>
>
> 2014-07-10 16:28 GMT+02:00 Mark Rizun <[hidden email]
> <mailto:[hidden email]>>:
>
>     Ok, thanks)
>
>
>     2014-07-10 16:21 GMT+02:00 Nicolai Hess <[hidden email]
>     <mailto:[hidden email]>>:
>
>         2014-07-10 15:45 GMT+02:00 Mark Rizun <[hidden email]
>         <mailto:[hidden email]>>:
>
>             In the NautilusRefactoring class we have a method on a class
>             side:
>
>             sourceCodeRefactoringMenu: aBuilder
>                      <nautilusGlobalSourceCodeMenu>
>                      | target |
>                      target := aBuilder model.
>                      target selectedClass ifNotNil: [:selectedClass |
>             selectedClass
>             sourceCodeRefactoring: aBuilder ]
>
>             I'd like to understand how this line works: target :=
>             aBuilder model. I
>             mean, how aBuilder initializes a model?
>             Because, if you change the pragma from
>             <nautilusGlobalSourceCodeMenu> to
>             another one, you will get another result using this
>             particular line.
>
>             Mark
>
>
>         aBuilder is constructed from a PragmaMenuBuilder, this
>         PragmaMenubuilder calls all methods with
>         pragma <nautilusGlobalSourceCodeMenu>.
>
>         The model is initializes in for example, in AbstractNautilusUI
>         classMenuBuilder.
>
>
>         Nicolai
>
>
>
>
>
>             --
>             View this message in context:
>             http://forum.world.st/How-pragma-works-to-create-menu-tp4767409.html
>             Sent from the Pharo Smalltalk Users mailing list archive at
>             Nabble.com.
>
>
>
>

--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95