|
|
|
Re: Remove a contribution action in the contextual menu [message #891772 is a reply to message #891581] |
Mon, 25 June 2012 16:34  |
Eclipse User |
|
|
|
Yes of course.
First you need to know the ID of the GMF action you want to remove or to replace. In my case I want to replace the "CopyToImageAction" that allows to export the diagram (or selected EditParts) to a Image. You can find them looking throught the GMF plugins. In this page I found some of GMF actions (http://blog.lgylym.info/2010/05/add-new-entry-to-existing-context-menu.html)
Then you need to contribute an extension point into the desired plugin, something like the following code:
<extension
id="MOSKittExportToFile"
point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
<contributionItemProvider
class="es.cv.gvcase.mdt.common.actions.MOSKittCopyToImageItemProvider">
<Priority
name="Medium">
</Priority>
<popupContribution
class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
<popupStructuredContributionCriteria
objectClass="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
</popupStructuredContributionCriteria>
<popupAction
id="MOSKittCopyToImageAction"
path="/fileMenu/saveGroup">
</popupAction>
<popupPredefinedItem
id="CopyToImageAction"
path="/fileMenu/saveGroup"
remove="true">
</popupPredefinedItem></popupContribution>
</contributionItemProvider>
</extension>
As you can see, in the popupContribution entry I define two elements: my new Action (MOSKittCopyToImageAction) and the original action to be removed.
It's so easy to do. The main difficulty is to look for the ID of the action to be removed.
Best regards,
Marc
|
|
|
Powered by
FUDForum. Page generated in 0.07060 seconds