Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Re: Command Dropdown in Toolbar
Re: Command Dropdown in Toolbar [message #332131] Mon, 06 October 2008 15:00 Go to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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
>

Redirected to eclipse.platform.
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


Re: Command Dropdown in Toolbar [message #332132 is a reply to message #332131] Mon, 06 October 2008 15:04 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Re: Command Dropdown in Toolbar [message #332149 is a reply to message #332131] Tue, 07 October 2008 08:18 Go to previous message
Eclipse UserFriend
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
Previous Topic:How to know that autocompletion was automatically triggered, and stop it under some condition?
Next Topic:problem with unwanted notifications
Goto Forum:
  


Current Time: Wed Jul 17 19:43:22 GMT 2024

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

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

Back to the top