Skip to main content



      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 14:28 Go to next message
Eclipse UserFriend
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 16:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

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

Regards,

Aurelien Pupier
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 17:06 Go to previous messageGo to next message
Eclipse UserFriend
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 05:09 Go to previous messageGo to next message
Eclipse UserFriend
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 12:32 Go to previous messageGo to next message
Eclipse UserFriend
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 14:11 Go to previous messageGo to next message
Eclipse UserFriend
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 19:25 Go to previous messageGo to next message
Eclipse UserFriend
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 08:43 Go to previous message
Eclipse UserFriend
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: Sun Jul 06 09:52:57 EDT 2025

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

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

Back to the top