Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Adding menu-items to a rcp application
Adding menu-items to a rcp application [message #529863] Tue, 27 April 2010 13:58 Go to next message
Roel De Nijs is currently offline Roel De NijsFriend
Messages: 28
Registered: March 2010
Junior Member
Hi all,

When you want to add menus and menu-items to your rcp application, you have (as far as I know) 2 possibilities:
- using the menuContributions in plugin.xml
- using the ActionBarAdvisor.fillMenuBar

When I add a menu programmatically (that is through the fillMenuBar method) this menu is added at the very beginning of the menu-bar, the menus added through the menuContributions are added to the right.
I also tried to use insertBefore/insertAfter and use the id of a menu (defined in the plugin.xml), but then I got the error that the ID can't be found. At that moment the menuBar is still empty and it seems that the menus from plugin.xml are added after the fillMenuBar methods is executed (but not sure about that one)

Any suggestions how the alternatives can be combined together with complete control of the position of the menus in the menu bar?

Kind regards,
Roel
Re: Adding menu-items to a rcp application [message #530489 is a reply to message #529863] Thu, 29 April 2010 18:36 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Roel De Nijs wrote:
> (defined in the plugin.xml), but then I got the error that the ID can't
> be found. At that moment the menuBar is still empty and it seems that
> the menus from plugin.xml are added after the fillMenuBar methods is
> executed (but not sure about that one)

No, this is not true. First the ActionBarAdvisor is run, and then any
menuContributions are applied.

For example, check out
org.eclipse.ui.internal.ide.WorkbenchActionBuilder. It adds a
MenuManager with an ID of IWorkbenchActionConstants.M_FILE to the menu bar.

now menuContributions with menu:file?after=additions will go into the
File menu, and menuContributions with
menu:org.eclipse.ui.main.menu?after=file will go to the right of the
File menu.

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/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Adding menu-items to a rcp application [message #530718 is a reply to message #529863] Fri, 30 April 2010 15:36 Go to previous message
Roel De Nijs is currently offline Roel De NijsFriend
Messages: 28
Registered: March 2010
Junior Member
Hi Paul,

Quote:
First the ActionBarAdvisor is run, and then any
menuContributions are applied.

Thanks for confirming my assumption (but apparently I was clearly not able to explain my thoughts).

I had a look at the WorkbenchActionBuilder and I was trying to do the opposite of the example you mentioned (refering to an id defined in menuContributions in the ActionBarAdvisor), but that obviously won't work because menuContributions are applied after ActionBarAdvisor.

Kind regards,
Roel

[Updated on: Fri, 30 April 2010 15:36]

Report message to a moderator

Previous Topic:info rcp application ...
Next Topic:WorkbenchWindowControlContribution moves to incorrect position
Goto Forum:
  


Current Time: Wed Apr 24 22:59:00 GMT 2024

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

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

Back to the top