Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Unable to contribute to editor menus using org.eclipse.ui.menus
Unable to contribute to editor menus using org.eclipse.ui.menus [message #499101] Thu, 19 November 2009 20:30 Go to next message
Peter Nehrer is currently offline Peter NehrerFriend
Messages: 241
Registered: July 2009
Senior Member
Apologies if this has been asked and answered before, but I can't seem
to find a reference.

The documentation in org.eclipse.ui.editorActions extension point would
have one believe that it is possible to contribute menus created by an
editor's action bar contributor. However, this doesn't seem to be
possible (unless I'm missing something?) I can provide a simple test
case where an editor's action bar contributor creates a top-level menu
manager with a unique id; a menu contribution targeting that menu won't
show up. Should this work?
Re: Unable to contribute to editor menus using org.eclipse.ui.menus [message #499305 is a reply to message #499101] Fri, 20 November 2009 18:02 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

If you mean you'd like to use editorActions to create the menu and then contribute to it using o.e.ui.menus, that won't work.

o.e.ui.menus can see programmatic contributions, and o.e.ui.editorActions can see programmatic contributions and o.e.ui.menus contributions (because of the order they are applied in).

The old action extensions (actionSets, editorActions, etc) are processed last.

PW


Re: Unable to contribute to editor menus using org.eclipse.ui.menus [message #499320 is a reply to message #499305] Fri, 20 November 2009 19:05 Go to previous messageGo to next message
Peter Nehrer is currently offline Peter NehrerFriend
Messages: 241
Registered: July 2009
Senior Member
Thank you, Paul. Actually the problem I have goes the other way around.
I create a top-level menu in an editor's action bar contributor:

public void contributeToMenu(IMenuManager menuManager) {
super.contributeToMenu(menuManager);
IMenuManager editorMenuManager = new MenuManager("Sample Editor Menu",
"org.eclipse.ui.menus.test.sampleEditor");
menuManager.insertAfter(IWorkbenchActionConstants.MB_ADDITIO NS,
editorMenuManager);
editorMenuManager.add(new
Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}

Then I want to contribute a menu to it using o.e.ui.menus:

<menuContribution
locationURI="menu:org.eclipse.ui.menus.test.sampleEditor?after=additions ">
<command commandId="org.eclipse.ui.menus.test.commands.sampleCommand "
style="push">
</command>
</menuContribution>

The command and a handler for it are defined and active (also
successfully contributed to a context menu).

Am I missing something? Do you have an example where this does work?
Thanks again.

--Peter

Paul Webster wrote:
> If you mean you'd like to use editorActions to create the menu and then
> contribute to it using o.e.ui.menus, that won't work.
>
> o.e.ui.menus can see programmatic contributions, and
> o.e.ui.editorActions can see programmatic contributions and o.e.ui.menus
> contributions (because of the order they are applied in).
>
> The old action extensions (actionSets, editorActions, etc) are processed
> last.
>
> PW
>
Re: Unable to contribute to editor menus using org.eclipse.ui.menus [message #499328 is a reply to message #499320] Fri, 20 November 2009 20:15 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Ah, editor action bars suffer from the same problem. They're part of the legacy action system and are not exposed properly.

PW


Previous Topic:How to force editor to foreground?
Next Topic:Using a java.net.URLConnection with a proxy
Goto Forum:
  


Current Time: Tue Mar 19 04:13:40 GMT 2024

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

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

Back to the top