Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to enable/disable a command on a view toolbar?(There can be multiple instances of that view)
How to enable/disable a command on a view toolbar? [message #555368] Thu, 26 August 2010 08:46 Go to next message
Alexandra Niculai is currently offline Alexandra Niculai
Messages: 84
Registered: July 2009
Member
Hi

I have a view for which multiple instances may be open at the same time.
This view has a view toolbar with a command.
This command should be enabled or disabled, depending on what element is selected in the view.
This works.
The problem is that the command appears enabled on all the instances of the view(most of the time there will be more of them open) even if I selected an element only in one of the view instances. The button should be enabled only on the toolbar of the view that contains that specific element.
Is this possible, having the same command enabled on some view toolbars and disabled on others at the same time?
Thank you!

Greetings
Alexandra.
Re: How to enable/disable a command on a view toolbar? [message #555383 is a reply to message #555368] Thu, 26 August 2010 09:15 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6857
Registered: July 2009
Location: Ottawa
Senior Member

In 3.x, the enabled state of the command is an attribute of the Command.
That means that the command is globally enabled or disabled. This
shows up most prominently with multi-instance views.

In 4.x/e4 the enabled state is more an attribute of the active handler
and the context (like the view itself) which would hopefully support
this scenario.

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/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: How to enable/disable a command on a view toolbar? [message #555388 is a reply to message #555383] Thu, 26 August 2010 09:36 Go to previous message
Alexandra Niculai is currently offline Alexandra Niculai
Messages: 84
Registered: July 2009
Member
Thank you very much for the answer!
I really hoped it was possible...for 3.x, I mean.
But 4 is good hope, too.
I guess I have no other option but to move those commands on the main toolbar where they can be enabled/disabled/toggled/untoggled depending on which view is currently selected and which element of that view is selected. Leaving them on the view toolbar in these conditions would be just awkward.

Alexandra.
Previous Topic:Bundle Ad-Hoc Classloading Options In 3.6, Revisited
Next Topic:Propertytester always executed
Goto Forum:
  


Current Time: Wed Jul 23 04:07:25 EDT 2014

Powered by FUDForum. Page generated in 0.06512 seconds