Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Contribute to EMF Genmodel Menu
Contribute to EMF Genmodel Menu [message #1783735] Fri, 16 March 2018 12:34 Go to next message
Simon BBBBBBB is currently offline Simon BBBBBBBFriend
Messages: 54
Registered: March 2015
Member
Hello,

i am trying to Contribute a command to the rightlickmenu of the EMF Generator Model, right next to "Generate All" and i cant get it to work. Here is what i did:

plugin.xml:

   <extension point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="popup:org.eclipse.emf.codegen.ecore.genmodelMenuID?after=additions">
         <command
               commandId="someCommandId"
               id="someId"
               label="DoIt">
         </command>
      </menuContribution>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <command
            defaultHandler="java.path.to.the.handler.class.Handlerclass"
            description="Some description"
            id="someCommandId"
            name="DoIt">
      </command>
   </extension>


Handlerclass:
public class Handlerclass extends AbstractHandler {

    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {
        System.out.println("DoStuff");
        return null;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
    
    @Override
    public boolean isHandled() {
        return true;
    }
}



Am i missing something? Something wrong?

Thank you!
Re: Contribute to EMF Genmodel Menu [message #1784035 is a reply to message #1783735] Wed, 21 March 2018 19:35 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

I think you mean on the Gen Model editor's context menu? If I use the PDE Spy (Shift-Alt-F1) on the Gen Model editor, the contribution ID is `org.eclipse.emf.codegen.ecore.genmodel.presentation.GenModelEditorID`. And indeed using the following locationURI seems to do what you're looking for:

popup:org.eclipse.emf.codegen.ecore.genmodel.presentation.GenModelEditorID?before=open-actions

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Previous Topic:RCP how to make TreeViewer non editable
Next Topic:Port RCP Application to Juno - startup error
Goto Forum:
  


Current Time: Thu Sep 20 12:29:59 GMT 2018

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

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

Back to the top