Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Handlers enabledWhen based on String in View
Handlers enabledWhen based on String in View [message #663689] Wed, 06 April 2011 08:17 Go to next message
Ricky de Klerck is currently offline Ricky de Klerck
Messages: 295
Registered: January 2011
Senior Member
Quote:
Hi,

I have defined all my commands in the ui.commands extension and i want to retrieve all the commands programmatically. I know there is something like the commandManager.getAllCommands(), but this doesn't return anything.

I need all this because I want to enable/disable all listed commands in a category at the same time...

Hope someone can help me out.


Okay, I think i'm going in the wrong direction here. I guess what I should do is add an enabledWhen for my Handlers where I check the last executed command. I can set the id of this command in my view. Is it possible or should it be done in another way?

My situation:

I have one perspective with a toolbar with a couple of commands. When executing a command, a filter is set on a tree of a view. I want to user to see which filter is set by changing the images. So one image is pressed and the rest is normal....

[Updated on: Wed, 06 April 2011 09:52]

Report message to a moderator

Re: Get all commands defined in extension [message #663759 is a reply to message #663689] Wed, 06 April 2011 12:35 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/06/2011 04:17 AM, Ricky de Klerck wrote:
>
> I need all this because I want to enable/disable all listed commands in
> a category at the same time...

ICommandService (retrieved from the appropriate service locator) will
provide the list of commands for you.

I'll just point out that each command's enabled/disable state is
controlled by its active handler ... not by the command itself.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:Add java element decoration to a common navigator
Next Topic:how to define activeWhen for Undo/Redo handlers
Goto Forum:
  


Current Time: Thu Oct 23 15:14:55 GMT 2014

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

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