Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Select command handler based on where it's triggered from?
Select command handler based on where it's triggered from? [message #337039] Thu, 23 July 2009 00:07 Go to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
Can I assign a different handler to a command, depending on where it was
triggered from (e.g. from a specific toolbar icon vs from a menu item)?

I know how to override handlers when specific parts are in focus:

<handler class="test.FooHandler" commandId="testCommand">
<with variable="activePartId">
<equals value="testView"/>

...but this approach has some limitations (for example I'd like to
override the org.eclipse.ui.newWizard command when a specific view is in
focus, but the default handler should be used when the command is
triggered via the top-level menu, even if the view is still active).
Re: Select command handler based on where it's triggered from? [message #452927 is a reply to message #337039] Sat, 01 August 2009 14:33 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The short answer is no. The application state determines which handler is active. A command executed from a key, menu, or toolbar should work correctly based on the application context (not the placement of the command).

The only exception is context menus. When you open a context menu, activeMenu is a collection of string context menuIds. It would be possible to execute a different handler from a context menu. But that's about it.


Previous Topic:Reloading worspace preferences
Next Topic:Hide menu options and toolbar options
Goto Forum:

Current Time: Thu Apr 19 10:08:09 GMT 2018

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

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