Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Are we able to contribute to a toolbar item menu?
Are we able to contribute to a toolbar item menu? [message #464944] Tue, 20 March 2007 21:53 Go to next message
Jason is currently offline JasonFriend
Messages: 45
Registered: July 2009
Member
I've got a base plug-in which loads a dropdown toolbar item. I use the IMenuCreator interface...almost exactly like the example in this old post:

http://www.eclipsezone.com/forums/thread.jspa?messageID=9193 8529&#91938529

Now, I have another plug-in that I want to use to contribute to this dropdown toolbar menu. So far, I've been unsuccessful with this.

I've tried creating a GroupMarker in the toolbar menu, yet because I don't have a getId() method like I do in the MenuManager class (when I add normal menus), I can't seem to figure out what path to use. Is it a toolbar or menu path...or is this even possible?

Thanks in advance for any advice that can be offered!
Re: Are we able to contribute to a toolbar item menu? [message #464979 is a reply to message #464944] Wed, 21 March 2007 11:48 Go to previous messageGo to next message
Rohit Khariwal is currently offline Rohit KhariwalFriend
Messages: 114
Registered: July 2009
Senior Member
have you tried this with the actionsets concept.
Re: Are we able to contribute to a toolbar item menu? [message #464987 is a reply to message #464979] Wed, 21 March 2007 13:57 Go to previous messageGo to next message
Jason is currently offline JasonFriend
Messages: 45
Registered: July 2009
Member
Can you explain that question a little further? I create an actionset extension in my contributing plug-in, but part of my problem is discovering the path of the toolbar menu that I am contributing to. It's not obvious (if even possible) like a regular menu is.

If that's not what you're talking about, I'd like to hear your approach...thanks for the reply!
Re: Are we able to contribute to a toolbar item menu? [message #465239 is a reply to message #464944] Mon, 26 March 2007 15:31 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The only way you could get another plugin to contribute to your dropdown
is if youre IMenuCreator provides that capability ... i.e. you write it
yourself.

In 3.3 with the new menu contribution stuff, other plugins *can*
contribute to a menu contribution dropdown menu.

Later,
PW


Re: Are we able to contribute to a toolbar item menu? [message #465484 is a reply to message #465239] Thu, 29 March 2007 19:57 Go to previous messageGo to next message
Jason is currently offline JasonFriend
Messages: 45
Registered: July 2009
Member
Thanks for all of the responses! Paul, at a high level, how you would you go about writing that functionality?

I see two options:

1) Have the ActionBarAdvisor class read the extension registry for menu items that have a menuPath of something specific (like "toolbaritemname\toolbarmenu\markername") and then add those actions to the IMenuCreator (this approach wouldn't change my IMenuCreator class at all).

2) Add GroupMarkers to the toolbar menu and have the IMenuCreator class read the registry, matching up the menuPath with the GroupMarker name. This approach seems like overkill to me, because I really just want to read the registry once and it seems the only logical place in this class is in the getMenu method and that method rebuilds the menu on every click (or at least, it does in my example...I suppose I could change that, but I'm unaware of the ramifications of doing that).

Thanks for your advice!
Re: Are we able to contribute to a toolbar item menu? [message #465637 is a reply to message #465484] Tue, 03 April 2007 18:40 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Are you in 3.3? If so you can still use your IMenuCreator, and just use
the IMenuService/MenuManager to have the IMenuService do the work for you.

MenuManager fManaqer = new MenuManager();
Menu fMenu = null;
IMenuService fMenuService = .... // needs to be filled in,
// probably from the workbench

Then getMenu(*) can have code like:

if (fMenu==null) {
fMenuService.populateContributionManager(fManager,
"menu:my.dropdown.id");
fMenu = fManager.createContextMenu(parent);
}
return fMenu;


Then you can contribute commands use org.eclipse.ui.menus and a
<menuContribution/> with a location of "menu:my.dropdown.id".

You could also use <dynamic/> to contribute other kinds of contribution
items, like ActionContributionItems.

PW


Previous Topic:Multiple Selections in Widgets
Next Topic:EditorPart with model alone
Goto Forum:
  


Current Time: Thu Mar 28 23:09:07 GMT 2024

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

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

Back to the top