Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Command API and Global actions
Command API and Global actions [message #335223] Thu, 26 March 2009 14:44 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).

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: Command API and Global actions [message #335225 is a reply to message #335223] Thu, 26 March 2009 15:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33252
Registered: July 2009
Senior Member
Christophe,

It's best not to post the same question to multiple groups with separate
post. Given that the EMF editor registers handles programmatically, I
don't imagine it's possible to have two handlers. I could be wrong, but
it seems unlikely...


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).
>
> 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
>
>
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Command API and Global actions [message #335305 is a reply to message #335223] Tue, 31 March 2009 16:03 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Christophe Bouhier wrote:

> <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>

If there is a handler conflict, it should show up in your error log. If
not, the other way to check is to run with handler tracing for your
command. See
http://wiki.eclipse.org/Platform_Command_Framework#Tracing_O ption

It might not be a conflict, you need activeEditorId if you want to
compare it to an id ... activeEditor is the IEditorPart.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:Update/Install feature from command line
Next Topic:[menus] submenu in popup menu does not show up when manually populated
Goto Forum:
  


Current Time: Fri Nov 08 21:49:44 GMT 2024

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

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

Back to the top