Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Adding menuitems to contextmenus
Adding menuitems to contextmenus [message #153700] Fri, 05 October 2007 07:12 Go to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

I have studied the "Add custom action" section of the tutorial to
implement my own elements in the "right-click menus" - or context menus.

First problem: The elements only shows when I right click the diagram,
and not when I right click the "Topic" class.

Second problem: I want to run my own code (not as actions, maybe I'll
dare to try this later) when I click a menu element. Should this be done
like in the tutorial (the "run" method), or can I do this in a simpler
way - and how do i select the "right clicked class" (selectedElement in
tutorial?)


Regards,

Tomas
Re: Adding menuitems to contextmenus [message #153735 is a reply to message #153700] Fri, 05 October 2007 07:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ijerez2001.gmail.com

I have made the following:
1. In the plugin.xml go to the extensions page.
2. You can see a "org.eclipse.ui.popupMenus", else you have to add a new
with the button "Add...".
3. Right-click in org.eclipse.ui.popupMenus and New->ObjectContribution.
4. When you select the new objectcontribution that you have created, in the
rigth, you modify the box "objectClass" with you editpart target, depend the
element that you have chosen the popupmenu appear in the context menu. Also
you have to give a id, for example, program.diagram.MyID
5. You select your created objectContribution and right-click, you can add a
new menu (optional) and your action (obligatory).
6. In the action you have to write the class (you have to create in the
diagram project) that implement your action. If you use a menu you must
write the menubarpath, etc.

I saw a example with, in the extension page, click to the "Add..." button
and in the tab Extension wizard you select Popmenu template, it´s good to
learn, i used this.

Regards.

"Tomas Zijdemans" <trommas@yahoo.com> escribió en el mensaje de
noticias:fe5679$fe$1@build.eclipse.org...
>I have studied the "Add custom action" section of the tutorial to implement
>my own elements in the "right-click menus" - or context menus.
>
> First problem: The elements only shows when I right click the diagram, and
> not when I right click the "Topic" class.
>
> Second problem: I want to run my own code (not as actions, maybe I'll dare
> to try this later) when I click a menu element. Should this be done like
> in the tutorial (the "run" method), or can I do this in a simpler way -
> and how do i select the "right clicked class" (selectedElement in
> tutorial?)
>
>
> Regards,
>
> Tomas
Re: Adding menuitems to contextmenus [message #153819 is a reply to message #153735] Fri, 05 October 2007 08:38 Go to previous message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Wow! Thanks :)

This really opened my eyes (I love step by step explanation)


Regards,

Tomas

Iván Jerez wrote:
> I have made the following:
> 1. In the plugin.xml go to the extensions page.
> 2. You can see a "org.eclipse.ui.popupMenus", else you have to add a new
> with the button "Add...".
> 3. Right-click in org.eclipse.ui.popupMenus and New->ObjectContribution.
> 4. When you select the new objectcontribution that you have created, in
> the rigth, you modify the box "objectClass" with you editpart target,
> depend the element that you have chosen the popupmenu appear in the
> context menu. Also you have to give a id, for example, program.diagram.MyID
> 5. You select your created objectContribution and right-click, you can
> add a new menu (optional) and your action (obligatory).
> 6. In the action you have to write the class (you have to create in the
> diagram project) that implement your action. If you use a menu you must
> write the menubarpath, etc.
>
> I saw a example with, in the extension page, click to the "Add..."
> button and in the tab Extension wizard you select Popmenu template, it´s
> good to learn, i used this.
>
> Regards.
>
> "Tomas Zijdemans" <trommas@yahoo.com> escribió en el mensaje de
> noticias:fe5679$fe$1@build.eclipse.org...
>> I have studied the "Add custom action" section of the tutorial to
>> implement my own elements in the "right-click menus" - or context menus.
>>
>> First problem: The elements only shows when I right click the diagram,
>> and not when I right click the "Topic" class.
>>
>> Second problem: I want to run my own code (not as actions, maybe I'll
>> dare to try this later) when I click a menu element. Should this be
>> done like in the tutorial (the "run" method), or can I do this in a
>> simpler way - and how do i select the "right clicked class"
>> (selectedElement in tutorial?)
>>
>>
>> Regards,
>>
>> Tomas
>
Previous Topic:how to add copy paste action to the context menu
Next Topic:How to run "Arrange all" function
Goto Forum:
  


Current Time: Sat Jun 07 17:51:11 EDT 2025

Powered by FUDForum. Page generated in 0.03626 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top