Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Order of Toolbars on the Coolbar
Order of Toolbars on the Coolbar [message #458314] Thu, 16 November 2006 18:02 Go to next message
Eclipse UserFriend
Hi,

I have big problems with bad ordering of Toolbars in my RCP app. I am adding several Toolbars from fillCoolBar method and others from XML configuration. Its reversed etc etc.

Is it possible to explicitly re-order the toolbars on my coolbar? I want to have the toolbar with New-Open-Save actions first but I am not able to do this.

Thanks in advance for help.

Lukas
Re: Order of Toolbars on the Coolbar [message #458322 is a reply to message #458314] Fri, 17 November 2006 04:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bhupendra229.gmail.com

Hi,

This is what eclipse doc says-
"If two or more actions are contributed to a menu or toolbar by a single extension the actions will appear in the reverse order of how they are listed in the plugin.xml file. This behavior is admittedly unintuitive. However, it was discovered after the Eclipse Platform API was frozen. Changing the behavior now would break every plug-in which relies upon the existing behavior. "

You can read it in -
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/extension-points/org_eclipse_ui_a ctionSets.html

So, what I understand from your problem, you will have to add actions in reverse order of what you want.

Cheers!
Re: Order of Toolbars on the Coolbar [message #458324 is a reply to message #458322] Fri, 17 November 2006 05:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: peter_ossipov.mail.ru

Hello Bhupendra !
Thanks very much for the answer! It is very useful indeed, but it does
not just answer my question in full. :-)
Again, thanks for it.
It strikes me, that I can use menubarPath element. Though I do not
understand how to populate in a menumanger available menu paths. How do
I do that? For example, this path file/open/open.ext
where "open" subpath is coming from? Does it appear anywhere in the
code, because file - does in IWorkbenchActionConstants.M_FILE?

Bhupendra Bhardwaj wrote:
> Hi,
>
> This is what eclipse doc says-
> "If two or more actions are contributed to a menu or toolbar by a single extension the actions will appear in the reverse order of how they are listed in the plugin.xml file. This behavior is admittedly unintuitive. However, it was discovered after the Eclipse Platform API was frozen. Changing the behavior now would break every plug-in which relies upon the existing behavior. "
>
> You can read it in -
> http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/extension-points/org_eclipse_ui_a ctionSets.html
>
> So, what I understand from your problem, you will have to add actions in reverse order of what you want.
>
> Cheers!
>
Re: Order of Toolbars on the Coolbar [message #458330 is a reply to message #458324] Fri, 17 November 2006 08:56 Go to previous messageGo to next message
Eclipse UserFriend
Peter Osipov wrote:
> Hello Bhupendra !
> Thanks very much for the answer! It is very useful indeed, but it does
> not just answer my question in full. :-)
> Again, thanks for it.
> It strikes me, that I can use menubarPath element. Though I do not
> understand how to populate in a menumanger available menu paths. How do
> I do that? For example, this path file/open/open.ext
> where "open" subpath is coming from? Does it appear anywhere in the
> code, because file - does in IWorkbenchActionConstants.M_FILE?

In eclipse, the WorkbenchActionBuilder adds the basic framework to the
main menu bar. i.e. it adds file and close.ext. Then any declaration
(like an actionSet) must supply it's menu path. You can use any path
that was contributed by the WorkbenchActionBuilder, but not by another
declaration.

In RCP, your ApplicationActionBarAdvisor adds the basic menu framework.
It works the same way (WorkbenchActionBuilder is the eclipse SDK
application action bar advisor).

The paths themselves should be an optional path of menuIds followed by a
group. For example, file/close.ext (file is a menuId and close.ext is a
group). Or navigate/goTo/additions (navigate is the main menu id, goTo
is a submenu id, and additions is the group).

Later,
PW
Re: Order of Toolbars on the Coolbar [message #458333 is a reply to message #458324] Fri, 17 November 2006 09:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bhupendra229.gmail.com

Hi,

I am assuming that you are creating the menu manager. Or are you trying to add to the existing menus in the eclipse?

If you are creating your own menu manager then in your actionbaradvisor you must have given the id for the menu. the path basically referes to the ids of the menu. So if you know the id of the parent menu, you can use the path to add the action to that menu.

Don't know if that answers your particular question.

Cheers!
Re: Order of Toolbars on the Coolbar [message #458346 is a reply to message #458314] Sat, 18 November 2006 07:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: spider_a.freenet.am

I think id numbers will help you. So long time ago I had such problem and as I remember I've solve it using id numbers.
Re: Order of Toolbars on the Coolbar [message #458362 is a reply to message #458314] Sun, 19 November 2006 15:54 Go to previous messageGo to next message
Eclipse UserFriend
Thanks all for your replies but I have still the problem. Reordering action sets in the plugin.xml didnt help. This is my fillCoolBar(ICoolBarManager coolBar):

// cant do this - strange exception:
// coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

IToolBarManager undoRedoBar = new ToolBarManager(coolBar.getStyle());
undoRedoBar.add(undoAction);
undoRedoBar.add(redoAction);
coolBar.add(undoRedoBar);

As you can see I am adding one action programatically (undo/redo toolbar) and others from the plugin.xml (actionSets: file, edit). I cant find the right combination to have this order:

- file toolbar
- undo/redo toolbar (programatically added)
- edit toolbar (and others from plugin.xml)

Whats wrong? I really need to order it since we do need to distribute our RCP application.

Thanks, Lukas


-
Re: Order of Toolbars on the Coolbar [message #458382 is a reply to message #458362] Mon, 20 November 2006 08:09 Go to previous messageGo to next message
Eclipse UserFriend
Anything that you add programmatically you can control where it goes.
Anything that comes in from actionSets ... well, those will definitely
be in reverse order.

But you can build the basic structure of the coolbar and then add
actions to them afterwards. Check out how WorkbenchActionBuilder
creates the main coolbar for eclipse (it's in the org.eclipse.ui.ide
project).

Later,
PW
Re: Order of Toolbars on the Coolbar (long -- pastebin) [message #459046 is a reply to message #458382] Mon, 27 November 2006 16:01 Go to previous messageGo to next message
Eclipse UserFriend
> Anything that you add programmatically you can
> control where it goes.
> Anything that comes in from actionSets ... well,
> those will definitely
> be in reverse order.
>
> But you can build the basic structure of the coolbar
> and then add
> actions to them afterwards. Check out how
> WorkbenchActionBuilder
> creates the main coolbar for eclipse (it's in the
> org.eclipse.ui.ide
> project).

Hello, I have tried everything with no luck. I spent a week with testing, studing Eclipse code, searching. I am providing full source my actionset, could anybody help me to order my XML elements to achieve this order (left to right):
- file (new, open)
- edit (select, translate, rotate...)
- filters (filter, filter points, filter lines...)
- options (point ant click button)

I am not able to find THE KEY. Eclipse always position in this strange order (left to right):
- filters (filter, filter points, filter lines...)
- options (point ant click button)
- file (new, open)
- edit (select, translate, rotate...)

I have all items in descending order, my fillCoolbar method is empty (I do not add anything programatically)

(longer XML file)

http://paste2.org/p/435
Re: Order of Toolbars on the Coolbar (long -- pastebin) [message #459118 is a reply to message #459046] Tue, 28 November 2006 03:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bhupendra229.gmail.com

From your description, what I understand is you want to order your MenuManagers(file, edit,filters,options).

I think what you should do is add menu managers in the order you want in your fillMenuBar() method. Then you can add actions to those menumanagers in plugin xml.

Other option can be that you add one GroupMarker for each menumanager in your fillMenuBar() method.
menuBar.add(new GroupMarker(<groupname>));
You can add GroupMaker in the order you want and then add menumanager and actions in your plugin.xml


hope it helps
Bhupendra
Re: Order of Toolbars on the Coolbar (long -- pastebin) [message #459134 is a reply to message #459046] Tue, 28 November 2006 10:11 Go to previous messageGo to next message
Eclipse UserFriend
Lukas Zapletal wrote:
> Hello, I have tried everything with no luck. I spent a week with testing, studing Eclipse code, searching. I am providing full source my actionset, could anybody help me to order my XML elements to achieve this order (left to right):
> - file (new, open)
> - edit (select, translate, rotate...)
> - filters (filter, filter points, filter lines...)
> - options (point ant click button)
>
> I am not able to find THE KEY. Eclipse always position in this strange order (left to right):
> - filters (filter, filter points, filter lines...)
> - options (point ant click button)
> - file (new, open)
> - edit (select, translate, rotate...)


I wasn't clear in my post ... within an actionSet, <action/> elements
are filled in the reverse order. Between actionSets, the order will
always be non-deterministic. *always*


Programmatically is the only way to really control order. AFAIK, you
would need to programmatically add groups and ToolBarManagers to the
coolbar, and then use the actionSets to fill in the actions.

Check out the way WorkbenchActionBuilder adds things like the Help
Toolbar group in fillCoolBar(*).

Later,
PW
Re: Order of Toolbars on the Coolbar (long -- pastebin) [message #459210 is a reply to message #459134] Wed, 29 November 2006 03:54 Go to previous messageGo to next message
Eclipse UserFriend
Hello, Paul.

Thanks for you support. I was talking about coolbar (it wasnt clear). I also already tried group markers with no effect:

fillCoobar(CoolBarManager m) {
m.add(GrouMarker("file"));
m.add(GrouMarker("edit"));
..
}

<xml>
<actionSet>
<action toolbarPath="file" ... />
<action toolbarPath="file" ... />
<action toolbarPath="file" ... />
</actionSet>
<actionSet>
<action toolbarPath="edit" ... />
<action toolbarPath="edit" ... />
<action toolbarPath="edit" ... />
</actionSet>
</xml>

(also as http://pastebin.com/835178)

Here is the code from WorkbenchActionBuilder, if you would comment it for me:

coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_HELP));

{ // Help group
IToolBarManager helpToolBar = new ToolBarManager(coolBar
.getStyle());
helpToolBar.add(new Separator(IWorkbenchActionConstants.GROUP_HELP));
// helpToolBar.add(searchComboItem);
// Add the group for applications to contribute
helpToolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP));
// Add to the cool bar manager
coolBar.add(new ToolBarContributionItem(helpToolBar,
IWorkbenchActionConstants.TOOLBAR_HELP));
}
Re: Order of Toolbars on the Coolbar (long -- pastebin) [message #459266 is a reply to message #459210] Wed, 29 November 2006 13:42 Go to previous messageGo to next message
Eclipse UserFriend
I think if you want to add it to a "file" toolbar and an "edit" toolbar,
you have to do something like the snippet your copied at the bottom of
your message.

IToolBarManager file = new ToolBarManager(coolBar.getStyle());
file.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
coolBar.add(new ToolBarContributionItem(file, "file"));

Then (in theory) your <action toolbarPath="file/additions" ... /> should
be able to add to the file toolbar in the main coolbar.


Later,
PW
Re: Order of Toolbars on the Coolbar (long -- pastebin) [message #459298 is a reply to message #459266] Thu, 30 November 2006 04:00 Go to previous messageGo to next message
Eclipse UserFriend
&gt; I think if you want to add it to a "file" toolbar and
&gt; an "edit" toolbar,
&gt; you have to do something like the snippet your copied
&gt; at the bottom of
&gt; your message.
&gt;
&gt; IToolBarManager file = new
&gt; ToolBarManager(coolBar.getStyle());
&gt; file.add(new
&gt; GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
&gt; coolBar.add(new ToolBarContributionItem(file,
&gt; "file"));
&gt;
&gt; Then (in theory) your <action
&gt; toolbarPath="file/additions" ... /> should
&gt; be able to add to the file toolbar in the main
&gt; coolbar.

I have tried this:

IToolBarManager tb = new ToolBarManager(coolBar.getStyle());
tb.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
coolBar.add(new ToolBarContributionItem(tb, "file"));

tb = new ToolBarManager(coolBar.getStyle());
tb.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
coolBar.add(new ToolBarContributionItem(tb, "filter"));

And in the plugin.xml this:

actionSet id="file" ... action toolbarPath="file" ...
actionSet id="filter" ... action toolbarPath="filter" ...

But the filter is still preceding file toolbar. I have also tried this:

toolbarPath="file/additions"
toolbarPath="filter/additions"

But this hides these two toolbars (they are not shown).

What am I missing? Who is dumb? Me or Eclipse RCP? I am playing with this for a week and I cant still distribute my finished application because of funny toolbar order.
Re: Order of Toolbars on the Coolbar (long -- pastebin) [message #459371 is a reply to message #459298] Thu, 30 November 2006 13:33 Go to previous messageGo to next message
Eclipse UserFriend
Lukas Zapletal wrote:
>
> I have tried this:
>
> IToolBarManager tb = new ToolBarManager(coolBar.getStyle());
> tb.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
> coolBar.add(new ToolBarContributionItem(tb, "file"));
>
> tb = new ToolBarManager(coolBar.getStyle());
> tb.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
> coolBar.add(new ToolBarContributionItem(tb, "filter"));
>
> And in the plugin.xml this:
>
> actionSet id="file" ... action toolbarPath="file" ...
> actionSet id="filter" ... action toolbarPath="filter" ...
>
> But the filter is still preceding file toolbar. I have also tried this:
>
> toolbarPath="file/additions"
> toolbarPath="filter/additions"
>
> But this hides these two toolbars (they are not shown).

What version of eclipse are you building against? There is a
coolbar+actionSet problem in eclipse 3.2.1

Later,
PW
Re: Order of Toolbars on the Coolbar (long -- pastebin) [message #459426 is a reply to message #459371] Fri, 01 December 2006 02:44 Go to previous messageGo to next message
Eclipse UserFriend
&gt; What version of eclipse are you building against?
&gt; There is a toolbar+actionSet problem in eclipse 3.2.1

I have Eclipse 3.2.1 but the application is built with Eclipse RCP SDK 3.2.0. I am running Ubuntu Linux.
Re: Order of Toolbars on the Coolbar (long -- pastebin) [message #459442 is a reply to message #459426] Fri, 01 December 2006 07:44 Go to previous messageGo to next message
Eclipse UserFriend
Lukas Zapletal wrote:
>
> I have Eclipse 3.2.1 but the application is built with Eclipse RCP SDK 3.2.0. I am running Ubuntu Linux.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=136847

Then you might be running into this bug, if I've read your problem
description correctly. It think a workaround is instantiating
CoolBarManager2 and ToolBarManager2

Later,
PW
Re: Order of Toolbars on the Coolbar (long -- pastebin) [message #459500 is a reply to message #459442] Sun, 03 December 2006 08:22 Go to previous message
Eclipse UserFriend
Yes it shows now, thank you Paul. Eclipse warns I use internal classes but it works. I hope this wont break up deployment.
Previous Topic:Using Junit Plugin Tests And Automated Testing Framework
Next Topic:include 3rd party jar in export
Goto Forum:
  


Current Time: Mon Apr 14 23:34:49 EDT 2025

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

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

Back to the top