|
Re: Command Dropdown in Toolbar [message #332132 is a reply to message #332131] |
Mon, 06 October 2008 15:04 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Paul Webster wrote:
> Chris wrote:
>> Hi,
>>
>> I have a (dynamic) set of actions which should be displayed in a
>> dropdown menu in the toolbar. The dropdown is intended to be a
>> selection between different options. To visualize this, when the user
>> selects an entry from the dropdown menu, the text and the image of the
>> main dropdown element should be synchronized with the selected action.
>>
>> To accomplish this, I've made a dynamic contribution to
>> org.eclipse.ui.menus which provides the actions. This
>> CompoundContributionItem fills the ToolbarContributionItem also
>> declared under org.eclipse.ui.menus.
>>
>> My problem is to replace the dropdown's text and image with the
>> selection, since the automatically created CommandContributionItem
>> does not offer any way to do so after creation. My current workaround
>> is to delete the dropdown item and replace it with a new one each time
>> the users makes a selection but this is obviously very messy and has
>> further drawbacks. Maybe someone has an idea on how this can be
>> accomplished?
>>
>> Thank you for your help,
>> Chris
>>
In 3.4 (and 3.3), the handler for the main tool item would implement
org.eclipse.ui.commands.IElementUpdater ... a call to
org.eclipse.ui.commands.ICommandService.refreshElements(Stri ng, Map)
from the UI thread provides your active handler with the opportunity to
update icons, text, etc for that UIElement.
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/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Re: Command Dropdown in Toolbar [message #332149 is a reply to message #332131] |
Tue, 07 October 2008 08:18 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: novs.gmx.net
Hi again,
I partly solved the problem of setting the text and image of the dropdown
element by retrieving its ToolItem and setting its text/image.
However, two issues remain:
1: During the initialization of the editor, the ToolBar is still empty.
When is the right time to set up the ToolItem on loading?
2: I'd like the dropdown element to always have the same length,
independen from the length of its text. Is there a way to accomplish this?
Thanks,
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.03159 seconds