|
Re: [ecp] add operation to context menu [message #1065031 is a reply to message #1064992] |
Sun, 23 June 2013 16:47 |
Jonas Helming Messages: 699 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03748 seconds