Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Setting GlobalActionHandler for command
Setting GlobalActionHandler for command [message #335482] Fri, 10 April 2009 10:08 Go to next message
Rob is currently offline RobFriend
Messages: 27
Registered: July 2009
Junior Member
Hi,

I'm using ver. 3.3 and I'm trying to retarget the global delete action
using the commands framework. I've written my own DeleteHandler which
extends AbstractHandler.

<handler
class="mypackage.handlers.DeleteHandler"
commandId="org.eclipse.ui.edit.delete">
<activeWhen>
<with
variable="activePartId">
<equals
value="mypackage.views.myview">
</equals>
</with>
</activeWhen>
</handler>

If I add the "org.eclipse.ui.edit.delete" command as a popup menu in my
view it works fine - my handler is called and the delete key works.
However, I need to get it working from the "Edit" menu in the main RCP
menu.

I know, in my view, I need to call:
getViewSite().getActionBars().setGlobalActionHandler("org.eclipse.ui.edit.delete ",
someIAction);
My problem is, this method takes an IAction parameter. All I have is an
AbstractHandler? I thought the abstraction of commands meant we didn't
have to instantiate actions ourselves? Any idea what I should pass to this
method?

Thanks!
Re: Setting GlobalActionHandler for command [message #335530 is a reply to message #335482] Mon, 13 April 2009 14:10 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Rob wrote:

> If I add the "org.eclipse.ui.edit.delete" command as a popup menu in my
> view it works fine - my handler is called and the delete key works.
> However, I need to get it working from the "Edit" menu in the main RCP
> menu.

In 3.3 the Edit menu still used the retarget actions, which aren't
linked to commands. This was upgraded to be commands only in 3.4

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:eclipse 3.4.2 on Solaris 9
Next Topic:help with form Text
Goto Forum:
  


Current Time: Thu Apr 25 22:23:37 GMT 2024

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

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

Back to the top