Skip to main content



      Home
Home » Modeling » Graphiti » ContextMenu
ContextMenu [message #1778081] Sat, 09 December 2017 05:44 Go to next message
Eclipse UserFriend
How to remove the "remove" and "update" menu in the contextmenu?
Re: ContextMenu [message #1778140 is a reply to message #1778081] Mon, 11 December 2017 03:41 Go to previous messageGo to next message
Eclipse UserFriend
These entries are added automatically by the framework in DiagramEditorContextMenuProvider.addDefaultMenuGroupRest if an action for them is available in the tool.

So one option would be to remove the actions in DiagramEditorActionBarContributor, the other to provide your own context menu provider (as subclass of DiagramEditorContextMenuProvider) in DiagramBehavior.createContextMenuProvider.

Michael
Re: ContextMenu [message #1778219 is a reply to message #1778140] Tue, 12 December 2017 01:07 Go to previous messageGo to next message
Eclipse UserFriend
I hope to create mine context menu provider. I must modify the createContextMenuProvider in DiagramBehavior. But I don't want to modify the DiagramBehavior.java. Can i create a new DiagramBehavior as subclass of DiagramBehavior? Where should I put the new DiagramBehavior ?
Re: ContextMenu [message #1778248 is a reply to message #1778219] Tue, 12 December 2017 05:16 Go to previous messageGo to next message
Eclipse UserFriend
Yes, you will need to create a subclass of DiagramBehavior and just override createContextMenuProvider. The creation of that class needs to happen in your own subclass of DiagramEditor (method createDiagramBehavior).

HTH,
Michael
Re: ContextMenu [message #1778255 is a reply to message #1778248] Tue, 12 December 2017 06:18 Go to previous messageGo to next message
Eclipse UserFriend
Does the DiagramEditor use the extension point org.eclipse.ui.editors in plugin.xml?
Can I override the isAvailable method in updatefeature and RemoveFeature?
@Override
public IRemoveFeature getRemoveFeature(IRemoveContext context) {
return new DefaultRemoveFeature(this) {
@Override
public boolean isAvailable(IContext context) {
return false;
}

};
}
Another one:
How can I remove or disable the align top, align middle in edit menu?

[Updated on: Tue, 12 December 2017 07:34] by Moderator

Re: ContextMenu [message #1778322 is a reply to message #1778255] Wed, 13 December 2017 02:38 Go to previous messageGo to next message
Eclipse UserFriend
Not sure what exactly you mean with "use", but the DiagramEditor class (or its subclass) needs to be registered for your file extension in plugin.xml.

Surely you can override the isAvailable method. Not sure what you intend to do, in case it is for trying to remove the feature from the context menu, I do not think that will help.

In general you can remove menu entries by removing their actions in DiagramEditorActionBarContributor (or rather your subclass of it, remember to register it together with your DiagramEditor in plugin.xml).

HTH,
Michael
Re: ContextMenu [message #1778409 is a reply to message #1778322] Wed, 13 December 2017 20:50 Go to previous message
Eclipse UserFriend
Thanks Michael
Previous Topic:Internationalization of Graphiti Components
Next Topic:How to prevent the selection of Shape
Goto Forum:
  


Current Time: Sun Apr 20 13:26:14 EDT 2025

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

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

Back to the top