Skip to main content



      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 10:46 Go to next message
Eclipse UserFriend
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 11:09 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Override editing commands with command framework in EMF editor [message #428684 is a reply to message #428680] Thu, 26 March 2009 11:23 Go to previous message
Eclipse UserFriend
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 Jul 15 03:20:32 EDT 2025

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

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

Back to the top