Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Contributing a menu item to a sub-menu defined by an action provider
Contributing a menu item to a sub-menu defined by an action provider [message #492280] Mon, 19 October 2009 18:28 Go to next message
Bruno Fischel is currently offline Bruno FischelFriend
Messages: 6
Registered: July 2009
Junior Member
Hello,

I have created a few handlers and contributed them to a popup menu using the org.eclipse.ui.menu extension point. I am able to add those menu items fine but I haven't find a way to contribute those menu items to an existing sub-menu. That particular sub-menu is contributed through the navigatorContent extension point using an action provider.

I have tried:
popup:<view-id>?after=<sub-menu action provider id>
popup:<sub menu action provider id>

Though, nothing works. Is there a way around this? Do I need to create my own action provider to contribute to that sub-menu?

Is there an example out there showing how to use an action provider with the new command/handler API?

Thank you!
Re: Contributing a menu item to a sub-menu defined by an action provider [message #492295 is a reply to message #492280] Mon, 19 October 2009 20:23 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

have you tried the menu plugin spy? Alt+Shift+F2

Regards,

Aurelien Pupier


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: Contributing a menu item to a sub-menu defined by an action provider [message #492303 is a reply to message #492295] Mon, 19 October 2009 21:06 Go to previous messageGo to next message
Bruno Fischel is currently offline Bruno FischelFriend
Messages: 6
Registered: July 2009
Junior Member
I believe the menu plugin py is only available for 3.5. I am on 3.4 (and cannot upgrade).

I can contribute to the sub-menu if I use actionProvider in navigatorContent and set the 'dependsOn' property to the sub-menu actionProvider id. Though, I am not able to do this using commands and the new menus extension-point. It seems to me that it is not possible to migrate menus contributed through the navigatorContent extension point to the new org.eclipse.ui.menus extension point.
Re: Contributing a menu item to a sub-menu defined by an action provider [message #492369 is a reply to message #492303] Tue, 20 October 2009 09:09 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
Bruno Fischel wrote:
> I believe the menu plugin py is only available for 3.5. I am on 3.4 (and
> cannot upgrade).

No, the plugin-spy is part of 3.4, I use it regularly still being on 3.4.2.

See also

http://www.eclipse.org/pde/incubator/spy/

which confirms that.

HTH & Greetings from Bremen,

Daniel Krügler
Re: Contributing a menu item to a sub-menu defined by an action provider [message #492532 is a reply to message #492369] Tue, 20 October 2009 16:32 Go to previous messageGo to next message
Bruno Fischel is currently offline Bruno FischelFriend
Messages: 6
Registered: July 2009
Junior Member
I meant the Menu plugin spy is not part of 3.4. I use the regular plugin spy but that is of no help for a menu (you can't invoke it on a pop-up menu).
Re: Contributing a menu item to a sub-menu defined by an action provider [message #492560 is a reply to message #492280] Tue, 20 October 2009 18:11 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

o.e.ui.menus can't see anything that comes in as an objectContribution, for example. The order that menus are created is:

1) programmatic
2) menu contribuitons
3) legacy contributions (object contributions, actionSets, etc)

PW


Re: Contributing a menu item to a sub-menu defined by an action provider [message #492603 is a reply to message #492560] Tue, 20 October 2009 23:25 Go to previous messageGo to next message
Bruno Fischel is currently offline Bruno FischelFriend
Messages: 6
Registered: July 2009
Junior Member
I see. So if I understood correctly, I cannot contribute to legacy menus (created with o.e.ui.navigatorContent extension point for example) using the new o.e.ui.menus extension point.

Thanks for confirming what I suspected. I assume I can (programmatically) retrieve & call an IHandler in an IAction (I haven't tried that yet).

Re: Contributing a menu item to a sub-menu defined by an action provider [message #493637 is a reply to message #492603] Tue, 27 October 2009 12:43 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Yes, you can execute a command programmatically:

IHandlerService hs = (IHandlerService) serviceLocator.getService(IHandlerService.class);
hs.executeCommand("the.command.id", swtEventOrNull);

where serviceLocator is one of the IWorkbench, IWorkbenchWindow, or IWorkbenchPartSite (view or editor site).

PW


Previous Topic:Integrated with Team
Next Topic:How to disable Project->Build menu item in eclipse
Goto Forum:
  


Current Time: Fri Apr 26 20:30:47 GMT 2024

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

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

Back to the top