Home » Eclipse Projects » Sirius » [Popup menu] How to disable a context menu item by service
|Re: [Popup menu] How to disable a context menu item by service [message #1619357 is a reply to message #1593211]
||Mon, 16 February 2015 14:23
|| Maxime Porhel
Registered: July 2009
Location: Nantes, France
The precondition of OperationAction and PopupMenu VSM elements are
Collection<DSemanticDecorator>, PopupMenu, IDiagramCommandFactory,
EditPart, Point) and
Collection<DSemanticDecorator>, EObject, IInterpreter).
To hide your menu (PopupMenu) or just a menu entry (OperationAction,
ExternalJavaAction, ExternalJavaActionCall), you just have to complete
For example, in a DiagramDescription on ecore used to represent EPackage
and EClass element, you could put [thisEObject.oclIsKindOf(EPackage)/]
to enable your menu only when an EPackage is selected.
The evaluation context will be the first selected semantic element, you
also have access to the "views" variable, which references the selected
views (allows to retrieve all selected semantic elements, if required,
with the DSemanticDecorator.target EReference).
Additional note: if a popup menu is empty or if all its items are
disabled, it will not be displayed.
Le 30/01/2015 14:36, Laurent Redor a écrit :
> Thanks for your feedback.
> Le 29/01/2015 04:11, Huy Le a écrit :
>> I've got a popup menu defined as below (via Popup menu & Operation
>> - Rigth click on a Node X in diagram.
>> - a context menu "Set type as" appear, it contains 3 sub menu items A,
>> B, and C
>> - What we want is Menu item B is disabled programmatically. (because
>> Node X is already type of B)
>> How can we do that?
> There is currently no way to do that. You can fill a feature request for
> this need here: https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Sirius
>> As I see, there is no object type of Menu available from Java Service.
>> LE Thanh Huy.
Maxime - Obeo
Need professional services for Sirius?
Maxime Porhel - Obeo
Need training or professional services for Sirius?
Current Time: Thu Jan 28 00:29:40 GMT 2021
Powered by FUDForum
. Page generated in 0.02063 seconds