Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Associating a command to a global handler
Associating a command to a global handler [message #326016] Wed, 05 March 2008 13:51 Go to next message
Eclipse UserFriend
Originally posted by: bvkiran.yahoo.com

I am trying to move to the new command and menu way of adding popup menus
via extension. I have added a new command and a new popupmenu for a view
using the org.eclipse.ui.commands and org.eclipse.ui.menu extensions. I
have added cut copy paste as popup menus. I would like to associate them
with the global cut, copy paste menus.

I know using IAction I can manually create these actions and tie them
using setGlobalActionHandler(). How can I do the same thing with commands
and menus added via extension points. Thanks in advance.
Kiran
Re: Associating a command to a global handler [message #326073 is a reply to message #326016] Thu, 06 March 2008 19:15 Go to previous message
Eclipse UserFriend
You mean you want to provide your own handlers for the commands (like
org.eclipse.ui.edit.copy)?

From your createPartControl(*) if you have your own CopyHandler that
acts on your view, you would do something like:

createHandlers() {
IHandlerService hs
= (IHandlerService) getSite().getService(IHandlerService.class);
myCopyHandler = new CopyHandler(this);
hs.activeHandler("org.eclipse.ui.edit.copy", myCopyHandler);
}

Later,
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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Previous Topic:Reading Console View Messages
Next Topic:Help needed writing a custom expression for visibleWhen of a command menuContribution
Goto Forum:
  


Current Time: Fri Apr 18 21:14:10 EDT 2025

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

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

Back to the top