Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Removing context menu items from diagram
Removing context menu items from diagram [message #217648] Sat, 07 February 2009 00:31 Go to next message
Eclipse UserFriend
Originally posted by: nuclearpsyche.gmail.com

Hi,

I am wondering how to remove certain menu items from the default context menu.
For example when I right click a node on my diagram there's an edit
section. What if I want to remove Copy/Paste and only keep Duplicate
from the Edit submenu? Or what if I want to remove the Filters submenu
altogether?

I would basically like to know where I should look in the code to
customize the context menu.
Thank you very much for your help.

tamer
Re: Removing context menu items from diagram [message #217709 is a reply to message #217648] Sun, 08 February 2009 09:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Erazerx.gmx.de

Hi,

for some elements it works by adding a extension to the
contributionItemProviders extension point, making a popupContribution
and set remove to false. Here is an example for removing the add-group
and the navigate-group:

<extension
point=" org.eclipse.gmf.runtime.common.ui.services.action.contributi onItemProviders ">
<contributionItemProvider
checkPluginLoaded="false"
class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContribu tionItemProvider ">

<Priority name="Low"/>

<popupContribution
id="remove_popup_menu_id"
class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">

<popupStructuredContributionCriteria
objectClass=" org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart ">
</popupStructuredContributionCriteria>
<popupPredefinedItem id="navigateGroup" remove="true"/>
<popupPredefinedItem id="addGroup" remove="true"/>

</popupContribution>
</contributionItemProvider>
</extension>


The IDs for the popupPredefinedItem are defined in the class
org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.

But i am not sure if this works for all context menu entries this way.





Tamer schrieb:
> Hi,
>
> I am wondering how to remove certain menu items from the default context
> menu.
> For example when I right click a node on my diagram there's an edit
> section. What if I want to remove Copy/Paste and only keep Duplicate
> from the Edit submenu? Or what if I want to remove the Filters submenu
> altogether?
>
> I would basically like to know where I should look in the code to
> customize the context menu.
> Thank you very much for your help.
>
> tamer
>
Re: Removing context menu items from diagram [message #217765 is a reply to message #217709] Mon, 09 February 2009 03:34 Go to previous message
Eclipse UserFriend
Originally posted by: nuclearpsyche.gmail.com

Hi,

Thank you! This was very helpful! It did the trick for most of the
menus i wanted to get rid of.
However I don't know how to remove specific menu items from certain
menus. I will keep looking (example: removing the copy/paste from Edit,
and keep the Duplicate menu item).
Thanks again for your help.

tamer


On 2009-02-08 01:41:52 -0800, Arne <Erazerx@gmx.de> said:

> Hi,
>
> for some elements it works by adding a extension to the
> contributionItemProviders extension point, making a popupContribution
> and set remove to false. Here is an example for removing the add-group
> and the navigate-group:
>
> <extension
> point=" org.eclipse.gmf.runtime.common.ui.services.action.contributi onItemProviders ">
<contributionItemProvider

>
> checkPluginLoaded="false"
> class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContribu tionItemProvider ">


>
> <Priority name="Low"/>
>
> <popupContribution
> id="remove_popup_menu_id"
> class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">


>
> <popupStructuredContributionCriteria
> objectClass=" org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart ">
> </popupStructuredContributionCriteria>
> <popupPredefinedItem id="navigateGroup" remove="true"/>
> <popupPredefinedItem id="addGroup" remove="true"/>
>
> </popupContribution>
> </contributionItemProvider>
> </extension>
>
>
> The IDs for the popupPredefinedItem are defined in the class
> org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.
>
> But i am not sure if this works for all context menu entries this way.
>
>
>
>
>
> Tamer schrieb:
>> Hi,
>>
>> I am wondering how to remove certain menu items from the default context
>> menu.
>> For example when I right click a node on my diagram there's an edit
>> section. What if I want to remove Copy/Paste and only keep Duplicate
>> from the Edit submenu? Or what if I want to remove the Filters submenu
>> altogether?
>>
>> I would basically like to know where I should look in the code to
>> customize the context menu.
>> Thank you very much for your help.
>>
>> tamer
Previous Topic:[Announce] GMF 2.2.0 I200902071249 is available
Next Topic:Node position relative to another node position
Goto Forum:
  


Current Time: Sat Mar 06 18:11:27 GMT 2021

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

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

Back to the top