[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: Adding command to a toolbar

Teddy Walker wrote:
The command and its pulldown items appears, but the enablement works not
correct:

1) If the view loose the focus, the button in the toolbar is disabled.
For keybindings, this is what I expect (command is no longer available), but
toolbar buttons in the view should stay enabled.

You're right, that's not really desired behaviour but the system is working correctly. When there is no handler active (if the handler depends on the view part id or was contributed programmatically to the view site IHandlerService) the command isEnabled() returns false, and that will show up on toolbars.


I'm not sure how we could provide new behaviour, considering all commands (activeWhen, enabledWhen, visibleWhen) run off of a global context.


2) If the command is disabled, the button is not updated. The command
throws an event (new HandlerEvent(this, true, false), but the toolbar button is not
disabled.

What states are you in here? The command is disabled and the button is disabled ... then the command becomes enabled and the button is not updated to enabled? This works for me. If you could create simple testcase and open a bug at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform&component=UI&short_desc=[Contributions]


Note, if changing the handler enabled state outside the UI thread, there is already a bug open about that: https://bugs.eclipse.org/bugs/show_bug.cgi?id=210862

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