Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [ecp] add operation to context menu
[ecp] add operation to context menu [message #1064992] Sat, 22 June 2013 12:45 Go to next message
Daniel Golesny is currently offline Daniel Golesny
Messages: 12
Registered: January 2013
Junior Member
Hi,
the ECP/"Make it happen" example shows a "Send mail" operation for a string by using the extension point org.eclipse.emf.ecp.edit.controls.

Is there an example how to add an operation to my own type, which is part of my model.
In my case I have a linked object for that I want to run the operation.

Or better: The operation (e.g. PDF Generator) should be in the context menu of the master node.
The question is: How can I add an operation to the context menu?

Thanks,
Daniel
Re: [ecp] add operation to context menu [message #1065031 is a reply to message #1064992] Sun, 23 June 2013 12:47 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas Helming
Messages: 363
Registered: July 2009
Senior Member
Hi,
I assume you are running on Compatibility layer. If I understand you
correctly, you want to add something to the right click menu of the
model explorer.
If so, you can use the Eclipse menu extension Point. The location URI
for the model explorer is "org.eclipse.emf.ecp.ui.ModelExplorerView".
The following example add a menu entry with the label "Your Label" to
the project node. To adapt this, you need to:

1. Change the Label and the Icon attribute
2. Change the commandID attribute to the ID of the command you want to
execute
3. Change the node type, on which the context menu is shown. In the
example below, the menu entry is shown on a project. You can exchange
"org.eclipse.emf.ecp.core.ECPProject" with any other type, e.g.
"com.eclipsesource.makeithappen.model.task.User"

I hope this helps, please let me know if you have any additional questions
Regards
Jonas



<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"

locationURI="popup:org.eclipse.emf.ecp.ui.ModelExplorerView?after=org.eclipse.emf.ecp.ui.separatorProvider">
<command
commandId="your command ID"
label="Your Label"
icon="your icon"
style="push">
<visibleWhen
checkEnabled="false">
<with
variable="activeMenuSelection">
<and>
<count
value="1">
</count>
<iterate>
<instanceof
value="org.eclipse.emf.ecp.core.ECPProject">
</instanceof>

</iterate>
</and>
</with>
</visibleWhen>
</command>
</menuContribution>
</extension>





Am 22.06.2013 18:45, schrieb Daniel Golesny:
> Hi,
> the ECP/"Make it happen" example shows a "Send mail" operation for a
> string by using the extension point org.eclipse.emf.ecp.edit.controls.
>
> Is there an example how to add an operation to my own type, which is
> part of my model.
> In my case I have a linked object for that I want to run the operation.
>
> Or better: The operation (e.g. PDF Generator) should be in the context
> menu of the master node.
> The question is: How can I add an operation to the context menu?
>
> Thanks,
> Daniel
Re: [ecp] add operation to context menu [message #1065187 is a reply to message #1065031] Mon, 24 June 2013 12:25 Go to previous message
Daniel Golesny is currently offline Daniel Golesny
Messages: 12
Registered: January 2013
Junior Member
It worked fine!
That's what I need.
Thanks, Daniel
Previous Topic:Using EObjectStore to select column values
Next Topic:EPackage : problem with interaction of packages
Goto Forum:
  


Current Time: Fri Apr 18 22:09:33 EDT 2014

Powered by FUDForum. Page generated in 0.01565 seconds