Skip to main content



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

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 11:13 Go to previous messageGo to next message
Eclipse UserFriend
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
>
>
>
>
>
>
Re: Command API and Global actions [message #335305 is a reply to message #335223] Tue, 31 March 2009 12:03 Go to previous message
Eclipse UserFriend
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: Tue Apr 29 04:20:31 EDT 2025

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

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

Back to the top