Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Toolbar pulldown - item order(How to get defined order of fragment contributions)
Toolbar pulldown - item order [message #1019232] Fri, 15 March 2013 09:27 Go to next message
Torsten Harms is currently offline Torsten Harms
Messages: 3
Registered: October 2012
Junior Member
The elements in the MainToolbar of a Eclipse RCP application are made up declarative. When fragments are started, they contribute to the toolbar by adding a value to a pulldown, they add their portion also declarative.

But the order of the labels in the pulldown seems to be pure luck:

item1, item3, item2, item4, ...

Can I give them a predefined, fixed order? like "item1, item2, item3, item4"

To explain further more:

<!-- Main Plugin -->
<extension point="org.eclipse.ui.menus">
<toolbar id="de.example.mainToolbar">
  <command
    commandId="de.example.commands.item1"
    icon="item1.png"
    id="dropdowntoolbar.dropdown"
    label="%app.command.label.item1"
    style="pulldown"
    mode="FORCE_TEXT"
    tooltip="%app.command.tooltip.item1">
  </command> 
....
</toolbar>
  <menuContribution
    locationURI="menu:dropdowntoolbar.dropdown"
  >
  </menuContribution>
</extension>

each Fragment contributes to the command referencing via the menuContribution:

<!-- Fragment -->
<menuContribution locationURI="menu:dropdowntoolbar.dropdown">
  <command
    commandId="de.example.commands.item2"
    icon="item1.png"
    label="%app.command.label.item2"
    mode="FORCE_TEXT"
    style="push"
    tooltip="%app.command.label.tooltip.item2">
  </command>
</menuContribution>



I never finish anyth...
Re: Toolbar pulldown - item order [message #1021740 is a reply to message #1019232] Wed, 20 March 2013 15:50 Go to previous message
Wim Jongman is currently offline Wim Jongman
Messages: 418
Registered: July 2009
Senior Member
Hi Torsten,

I think that is caused by the order they are started and evaluated. I have no
solution. Maybe make the menu dynamic and add a listener to it that
reorganizes the entries?

In what order would you want them anyway? Alphabet? Is the order also
different between restarts?

Regards,

Wim


> The elements in the MainToolbar of a Eclipse RCP application are made up
declarative. When fragments are started, they contribute to the toolbar by
adding a value to a pulldown, they add their portion also declarative.
>
> But the order of the labels in the pulldown seems to be pure luck:
>
> item1, item3, item2, item4, ...
>
> Can I give them a predefined, fixed order? like "item1, item2, item3,
item4"
>
> To explain further more:
>
> <!-- Main Plugin -->
> <extension point="org.eclipse.ui.menus">
> <toolbar id="de.example.mainToolbar">
> <command
> commandId="de.example.commands.item1"
> icon="item1.png"
> id="dropdowntoolbar.dropdown"
> label="%app.command.label.item1"
> style="pulldown"
> mode="FORCE_TEXT"
> tooltip="%app.command.tooltip.item1">
> </command>
> ....
> </toolbar>
> <menuContribution
> locationURI="menu:dropdowntoolbar.dropdown"
>>
> </menuContribution>
> </extension>
> each Fragment contributes to the command referencing via the
menuContribution:
>
> <!-- Fragment -->
> <menuContribution locationURI="menu:dropdowntoolbar.dropdown">
> <command
> commandId="de.example.commands.item2"
> icon="item1.png"
> label="%app.command.label.item2"
> mode="FORCE_TEXT"
> style="push"
> tooltip="%app.command.label.tooltip.item2">
> </command>
> </menuContribution>
Previous Topic:how to change colour of label in swt tree editor
Next Topic:Threading strategies in RCP
Goto Forum:
  


Current Time: Tue Sep 16 15:38:44 GMT 2014

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

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