[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Removing context menu items from diagram

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.contributionItemProviders">
<contributionItemProvider
          checkPluginLoaded="false"
class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContributionItemProvider">

      <Priority name="Low"/>

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

          <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
>