Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Toolbar icon order
Toolbar icon order [message #488118] Fri, 25 September 2009 11:32 Go to next message
Sue  is currently offline Sue
Messages: 14
Registered: July 2009
Junior Member
I've created a toolbar and I have several plugins that are contributing commands to it. Is there a way to control the order of the icons on the toolbar? It seems that the order is controlled by the order the plugins are loaded.
Re: Toolbar icon order [message #488142 is a reply to message #488118] Fri, 25 September 2009 12:26 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The contributions should be processed in plugin order, and use the ?before=<id> and ?after=<id> to control placement.

You must have an known ID to control your placement (either another contribution command or a separator). Otherwise each contribution is simply added to "additions" in plugin order.

You can add invisible named separators to better control your contribution placement if the different plugins don't know their relationship to each other's command contributions.

PW


Re: Toolbar icon order [message #488164 is a reply to message #488142] Fri, 25 September 2009 14:01 Go to previous messageGo to next message
Sue  is currently offline Sue
Messages: 14
Registered: July 2009
Junior Member
Thank you for the reply. I guess I'm doing something wrong here. This is my example:

// want to be #1
<menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions ">
<toolbar id="myToolbarId">
<command
commandId="firstCommand"
icon="icons/myIcon.gif"
id="firstCommandId"
label="First Icon"
style="push"
</command>
</toolbar>
</menuContribution>


// want to be #2
<menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=firstCommandId ">
<toolbar id="myToolbarId">
<command
commandId="secondCommand"
id="secondCommandId"
icon="icons/myIcon2.gif"
label="Second Icon"
style="push"
</command>
</toolbar>
</menuContribution>


I try to make the first command first, but it always appears after the second one. The second plugin is loaded first.

Do you see anything obvious that I am doing wrong?
Re: Toolbar icon order [message #488391 is a reply to message #488164] Mon, 28 September 2009 10:05 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You want locationURI="toolbar:myToolbarId?after=firstCommandId"

Otherwise you are trying to add a second toolbar (with the same ID as the first) to the main coolbar after a non-existent ID (since firstCommandId is not in the main coolbar)

PW


Previous Topic:Latest updates breaking WST
Next Topic:Difference in compilation between ECJ and Javac - BCEL fails to return class fileset
Goto Forum:
  


Current Time: Mon Sep 01 10:02:56 EDT 2014

Powered by FUDForum. Page generated in 0.01827 seconds