adding action to editparts [message #210216] |
Fri, 31 October 2008 15:25  |
Eclipse User |
|
|
|
Originally posted by: kelvinng.db.gmail.com
Can someone give me a quick overview of how I can add context menu
actions to editparts?
I managed to get an action to show up for my editpart, but I'm trying
to place that in sub-menu in the context menu.
~Kelvin Ng
|
|
|
|
|
Re: Fw: Re: adding action to editparts [message #210447 is a reply to message #210404] |
Wed, 05 November 2008 09:43   |
Eclipse User |
|
|
|
Viktor,
The implementation in
org.eclipse.gmf.runtime.diagram.ui.actions.AbstractDiagramMo delActionDelegate#getElements(ISelection)
might be what you're looking for. Your action delegate could extend
this one and inherit the behaviour.
Regards,
Linda
Viktor Kazakov wrote:
> Hello!
>
> I've created the class that implements the action, added by me to the
> edit part.
>
> The question is: how to get a reference to the edit part in the run()
> method (or anywhere else)? I need to know the values of some properties
> of the domain element, which edit part is the "owner" of the popup.
>
> So, how to do it better?
>
> Thanks!
>
> Viktor
>
> Jeff пишет:
>> hi Kelvin, I don't know whether that's what you want, wish help:
>>
>> <extension point="org.eclipse.ui.popupMenus">
>> <?gmfgen generated="false"?>
>> <objectContribution
>> adaptable="false"
>> id="...your objectContribution id"
>> objectClass="...your editpart full class name">
>> <action
>> class="...your action full class name"
>> enablesFor="..."
>> icon="..."
>> id="your action id"
>> label="..."
>> menubarPath="...">
>> </action>
>> </objectContribution>
>> </extension>
>>
>> as an action, you have to implement the interface IObjectActionDelegate
>>
>>
>>
>>
>> Kelvin Ng :
>>> Can someone give me a quick overview of how I can add context menu
>>> actions to editparts?
>>>
>>> I managed to get an action to show up for my editpart, but I'm trying
>>> to place that in sub-menu in the context menu.
>>>
>>> ~Kelvin Ng
>>>
|
|
|
Re: adding action to editparts [message #210476 is a reply to message #210216] |
Wed, 05 November 2008 13:58  |
Eclipse User |
|
|
|
Hi Kelvin,
I guess, the simpliest way to create a popup menu action is to add CustomAction
element to your GMFGen model (bug 174961):
1) Open GMFGen model
2) Select GenDiagram element. Create 'Context Menu' element inside it. Set
required 'context'(e.d. DiagramEditPart) and 'id' properties.
3) Create 'Custom Action' inside the newly created Context Menu. Set 'name'
and 'id' property. If you change 'Generate boilerplate implementation' from
'false' to 'true', action stub will be generated for you.
4) Generate diagram code
The functionality is just-implemented, it will be available in upcoming M3
build.
Best wishes,
Tanya.
> Can someone give me a quick overview of how I can add context menu
> actions to editparts?
>
> I managed to get an action to show up for my editpart, but I'm trying
> to place that in sub-menu in the context menu.
>
> ~Kelvin Ng
>
|
|
|
Powered by
FUDForum. Page generated in 0.03696 seconds