Skip to main content



      Home
Home » Eclipse Projects » Sirius » Defining a dynamic context submenu
Defining a dynamic context submenu [message #1661217] Mon, 09 March 2015 10:30 Go to next message
Eclipse UserFriend
Hi everyone, another question about context menus.

I would like to define a context menu item enabling to display a submenu whose contents are populated dynamically, typically to easily create dynamic menus such as in the "Create child" and "Create sibling" menu items in the EMF-generated editor's context menu.

It is possible to define such dynamic menu items with Sirius ?

Thanks in advance,

François
Re: Defining a dynamic context submenu [message #1661256 is a reply to message #1661217] Mon, 09 March 2015 10:52 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

Among the tools available in Sirius, create a new "Popop menu". Set the
name of your parent context menu as the ID or Label of this tool.
Then create an operation action for each submenu action you need. In the
precondition field, write a boolean expression that should be true if
you want to display this contextual action for the selected element.

Regards,
Steve

Le 09/03/2015 15:30, Francois Cabrol a écrit :
> Hi everyone, another question about context menus.
>
> I would like to define a context menu item enabling to display a
> submenu whose contents are populated dynamically, typically to easily
> create dynamic menus such as in the "Create child" and "Create sibling"
> menu items in the EMF-generated editor's context menu.
>
> It is possible to define such dynamic menu items with Sirius ?
>
> Thanks in advance,
>
> François


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Defining a dynamic context submenu [message #1661293 is a reply to message #1661256] Mon, 09 March 2015 11:12 Go to previous messageGo to next message
Eclipse UserFriend
Thank you very much, this approach should work with the examples I mentioned.

I also would like to know if there is a way to handle a dynamic menu in case its contents can only be known at runtime, for example if the menu items depend on the contents of the edited model.

François
Re: Defining a dynamic context submenu [message #1661396 is a reply to message #1661293] Mon, 09 March 2015 12:06 Go to previous messageGo to next message
Eclipse UserFriend
I might be missing a point, but I guess this only add some condition on
your expression, like checking the number of children (eContents()->size
< x) or if a certain feature starts with a certain prefix
(featureName.startsWith("prefix")). If the expression is too complex you
can use a java service.

Regards,
Steve

Le 09/03/2015 16:12, Francois Cabrol a écrit :
> Thank you very much, this approach should work with the examples I
> mentioned.
>
> I also would like to know if there is a way to handle a dynamic menu
> in case its contents can only be known at runtime, for example if the
> menu items depend on the contents of the edited model.
>
> François


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Defining a dynamic context submenu [message #1665060 is a reply to message #1661293] Wed, 11 March 2015 00:33 Go to previous message
Eclipse UserFriend
hello,

You can contribute your popup menu programmatically by using org.eclipse.ui.menus.

Using this ID: popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu for locationURI property of menuContribution
Previous Topic:Label Position of BorderItems
Next Topic:Deploy DSL
Goto Forum:
  


Current Time: Mon May 19 21:02:06 EDT 2025

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

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

Back to the top