Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 18: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] Fri, 07 March 2008 00:15 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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: Sat Nov 09 23:12:42 GMT 2024

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

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

Back to the top