Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Contribute custom context action
Contribute custom context action [message #1384846] Mon, 02 June 2014 13:55
Bartosz Popiela is currently offline Bartosz PopielaFriend
Messages: 21
Registered: March 2012
Junior Member
Hi! Smile
I'm trying to contribute custom context action to GMF based editor context menu using Eclipse 4.2 Framework. Extension point org.eclipse.ui.popupMenus has been deprecated, so I decided to use org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders extension point.
    <extension id="simulatorContributionItemProvider" name="%simulatorContributionItemProvider" point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
       <contributionItemProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContributionItemProvider">
         <Priority name="Lowest">
         </Priority>
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
            <popupStructuredContributionCriteria objectClass="my.domain.MyEditPart">                  
               <method name="getDiagramEditDomain().getEditorPart().getEditorSite().getId()"                     value="some.domain.SomeDiagramEditorID"/>                     
            </popupStructuredContributionCriteria>
            <popupMenuGroup path="/"
                  id="simulationGroup" separator="true">
            </popupMenuGroup>            
            <popupAction path="/simulationGroup" id="groupAction"/>
            <popupAction path="/simulationGroup" id="customAction"/>            
         </popupContribution>
      </contributionItemProvider>
    </extension>

some.domain.SomeDiagramEditor extends org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.
GMF groupAction is contributed correctly. As I found in GMF source code GroupAction class is instantiated programatically.
How should I contribute my customAction?
I was trying to use org.eclipse.ui.commands extension point, but it doesn't work.

    <extension
         point="org.eclipse.ui.commands">
      <command
            defaultHandler="my.domain.CustomActionHandler"
            id="customAction"
            name="Custom Action">
      </command>
    </extension>

Maybe I should use some other extension point?

[Updated on: Mon, 02 June 2014 15:53]

Report message to a moderator

Previous Topic:Drawing a rectangle in eclipse using GMF
Next Topic:nested rectangles to appear on canvas
Goto Forum:
  


Current Time: Tue Mar 09 04:52:01 GMT 2021

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

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

Back to the top