Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » [Commands] Toggle state depending on editor
icon5.gif  [Commands] Toggle state depending on editor [message #660046] Wed, 16 March 2011 16:29 Go to next message
Johannes Schneider is currently offline Johannes SchneiderFriend
Messages: 3
Registered: March 2011
Junior Member
Hi guys,

I have a problem related to Commands with toggle state. I have followed the tutorials (http://www.vogella.de/articles/EclipseCommands/article.html).
I have a command that has a toggle state. And I have been able to add that command to different positions (menu, toolbar, view toolbar).
And I am able to update the toggle state of the command depending on the active editor.

Now I have added that command to a toolbar within an editor (forms).

But now the button within an editor visualizes the toggle state of the active editor (which might be a different one).

Any idea how this could/should be solved?
I think I need something like a context-aware or "local" command copy...


Summary:
Command (toggle state) with different handlers activated for each editor.
Command added to a toolbar *within* an editor.

How to separate the toggle state of the button within the editor from the others?












Re: [Commands] Toggle state depending on editor [message #660090 is a reply to message #660046] Wed, 16 March 2011 18:33 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 03/16/2011 12:29 PM, js@cedarsoft.com wrote:
> Any idea how this could/should be solved?
> I think I need something like a context-aware or "local" command copy...

In 3.x you can't solve this problem, since the toggle state belongs to
the single global command instance.

In 4.x there is the concept of local context *and* commands have no
state in and of themselves.

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


Previous Topic:howto: programatically add coolbar items
Next Topic:Contribution to org.eclipse.ui.intro.configExtension
Goto Forum:
  


Current Time: Thu Mar 28 16:19:31 GMT 2024

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

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

Back to the top