Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Override editing commands with command framework in EMF editor
Override editing commands with command framework in EMF editor [message #428675] Thu, 26 March 2009 14:46 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi There,

I would like to request some direction on how to override the standard
COPY, CUT, PASTE actions using the command API? (Declarative form).

I add another page with a custom editor in the EMF Multipage editor and
would like to override the EMF handling of these commands.

My declaration below doesn't activate the Action for an Editor, which is
an EMF Editor BTW. The EMF Editor registers it's action with
setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);
through an ActionBar contributor.

Could this be a handler conflict?


Do I need to re-declare the paste command or is the handler sufficient?

<extension
point="org.eclipse.ui.handlers">
<handler
class="com.netxforge.networkdata.addon.PasteHandler"
commandId="org.eclipse.ui.edit.paste">
<activeWhen>
<with
variable="activeEditor">
<equals
value="com.MyEditor">
</equals>
</with></activeWhen>
</handler>
</extension>

Thanks Christophe
Re: Override editing commands with command framework in EMF editor [message #428680 is a reply to message #428675] Thu, 26 March 2009 15:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Christophe,

Comments below.

Christophe Bouhier wrote:
> Hi There,
>
> I would like to request some direction on how to override the standard
> COPY, CUT, PASTE actions using the command API? (Declarative form).
Did you see the long recent thread about Delete?
>
> I add another page with a custom editor in the EMF Multipage editor
> and would like to override the EMF handling of these commands.
>
> My declaration below doesn't activate the Action for an Editor, which
> is an EMF Editor BTW. The EMF Editor registers it's action with
> setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);
> through an ActionBar contributor.
>
> Could this be a handler conflict?
I imagine there can only be one handler.
>
>
> Do I need to re-declare the paste command or is the handler sufficient?
Probably you'd want to specialize the editing domain to create
specialized commands...
>
> <extension
> point="org.eclipse.ui.handlers">
> <handler
> class="com.netxforge.networkdata.addon.PasteHandler"
> commandId="org.eclipse.ui.edit.paste">
> <activeWhen>
> <with
> variable="activeEditor">
> <equals
> value="com.MyEditor">
> </equals>
> </with></activeWhen>
> </handler>
> </extension>
>
> Thanks Christophe


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Override editing commands with command framework in EMF editor [message #428684 is a reply to message #428680] Thu, 26 March 2009 15:23 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Thank you Ed, (sorry about multiple posts).
I actually get a handler conflict, would be nice if handler priority
could be set somehow.

Conflict for
'org.eclipse.ui.edit.paste':HandlerActivation(commandId=org. eclipse.ui.edit.paste,
handler=org.eclipse.ui.internal.handlers.WidgetMethodHandler@cecd26,
expression=,sourcePriority=0)
HandlerActivation(commandId=org.eclipse.ui.edit.paste,
handler=com.netxforge.networkdata.addon.PasteHandler,
expression=,sourcePriority=0)




Ed Merks wrote:
> Christophe,
>
> Comments below.
>
> Christophe Bouhier wrote:
>> Hi There,
>>
>> I would like to request some direction on how to override the standard
>> COPY, CUT, PASTE actions using the command API? (Declarative form).
> Did you see the long recent thread about Delete?
>>
>> I add another page with a custom editor in the EMF Multipage editor
>> and would like to override the EMF handling of these commands.
>>
>> My declaration below doesn't activate the Action for an Editor, which
>> is an EMF Editor BTW. The EMF Editor registers it's action with
>> setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);
>> through an ActionBar contributor.
>>
>> Could this be a handler conflict?
> I imagine there can only be one handler.
>>
>>
>> Do I need to re-declare the paste command or is the handler sufficient?
> Probably you'd want to specialize the editing domain to create
> specialized commands...
>>
>> <extension
>> point="org.eclipse.ui.handlers">
>> <handler
>> class="com.netxforge.networkdata.addon.PasteHandler"
>> commandId="org.eclipse.ui.edit.paste">
>> <activeWhen>
>> <with
>> variable="activeEditor">
>> <equals
>> value="com.MyEditor">
>> </equals>
>> </with></activeWhen>
>> </handler>
>> </extension>
>>
>> Thanks Christophe
Previous Topic:map modeling. valueType:String type problem.
Next Topic:Searching THE transformation framework for EMF
Goto Forum:
  


Current Time: Tue Sep 24 01:41:12 GMT 2024

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

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

Back to the top