Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Command
Command [message #655800] Tue, 22 February 2011 16:39 Go to next message
David  Pérez is currently offline David PérezFriend
Messages: 228
Registered: July 2009
Senior Member
I'm testing seriously the command framework, to get rid of Actions, and having just one way of doing things.

The problem I have is that I have a command with a toggle state:

<command
categoryId="com.jobisjob.crud"
id="com.jobisjob.crud.lock"
name="Bloquear cambios">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>

with a binding.
It appears in a toolbar and in a menu item in the main menu.

The problem is that when the toggle state changes, it isn't reflected on the other GUI items, i.e. when I click the toolbar, the menu item doesn't appear checked, and when I click the menu item, the toolbar icon doesn't appear checked.

My hanlder implements the IElementUpdater interface :

public void updateElement(UIElement element, Map parameters) {
element.setChecked(....);
}


How can this be solved?
Any suggestions will be very welcome.

David.
Re: Command [message #655810 is a reply to message #655800] Tue, 22 February 2011 16:46 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 22/02/11 10:09 PM, David Pérez wrote:
> The problem is that when the toggle state changes, it isn't reflected on
> the other GUI items, i.e. when I click the toolbar, the menu item
> doesn't appear checked, and when I click the menu item, the toolbar icon
> doesn't appear checked.

The state of the command is not updated automatically. Its the
responsibility of the handler. In your handler's execute method you need
to toggle and update the command's state

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: Command [message #655937 is a reply to message #655810] Wed, 23 February 2011 11:51 Go to previous message
David  Pérez is currently offline David PérezFriend
Messages: 228
Registered: July 2009
Senior Member
Thanks Prakash, now it works.

By the way, your command tips in http://blog.eclipse-tips.com/search?q=commands+part are very valuable and useful.
Previous Topic:Indigo M5: Buggy jars MANIFEST.MF?
Next Topic:Tabbed Properties Eclipse Question
Goto Forum:
  


Current Time: Thu Apr 25 07:44:22 GMT 2024

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

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

Back to the top