Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Command
Command [message #655800] Tue, 22 February 2011 11:39 Go to next message
Eclipse UserFriend
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 11:46 Go to previous messageGo to next message
Eclipse UserFriend
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 06:51 Go to previous message
Eclipse UserFriend
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: Mon Jul 07 01:35:33 EDT 2025

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

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

Back to the top