Command on Tree Editor [message #1018695] |
Thu, 14 March 2013 06:20  |
Eclipse User |
|
|
|
Hi !
Right now, i've my simple editor generated from my ecore mode, which works fine.
One of the Eclass of my model have an operation, and i would like to be able to run it from the editor.
What is the best way to do it ?
My problem
I tried to just copy-past code from on of my old GMF project with another custom action, but there's something wrong here :
<extension
id="%extension.id.0"
point="org.eclipse.ui.popupMenus">
<objectContribution
adaptable="false"
id="test.diagram.ui.objectContribution.RouteEditPart1"
objectClass="test.diagram.edit.parts.RouteEditPart">
<action
Now, i've no more edit.parts classes, so what am I supposed to use for
objectClass="test.diagram.edit.parts.RouteEditPart" ?
Thanks for your help !
Regards,
Valerian
|
|
|
|
|
|
Re: Command on Tree Editor [message #1019282 is a reply to message #1018887] |
Fri, 15 March 2013 07:10  |
Eclipse User |
|
|
|
In your handler:
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
if(currentSelection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection)
currentSelection).getFirstElement();
if(firstElement instanceof GenClass){
process((GenClass) firstElement);
}
}
return null;
}
Instead of GenClass you take your domain class.
best regards,
Gilbert
Valerian Merkling wrote:
> Ok there still is a problem i can't solve ...
>
> How can I, in my command, access to my model ? I need to read some
> properties of my EObjects.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04623 seconds