Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to define a org.eclipse.ui.menus contribution for sub-context-menus
How to define a org.eclipse.ui.menus contribution for sub-context-menus [message #841454] Wed, 11 April 2012 10:23 Go to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
Hello all,

I am trying to contribute to any popup menu by using the
org.eclipse.ui.menus extension point. But instead of placing the menu on
the first level of the context menu, it should appear in a sub-menu of
the context menu. More specifically in the 'Compare with' menu.

If I would use the popupMenus extension point, the menubarPath would be
'compareWithMenu/compareWithGroup'. But with the menus extension point I
haven't found a way to specify the location (other than in the first
level of the context menu)

My extension looks like this:
<menuContribution locationURI="menu:org.eclipse.ui.popup.any?after=???">
<command
commandId="org.example.MyCommand"
id="org.example.MyMenuItem"
label="..."
style="push">
</command>
</menuContribution>

But it seems to be not possible to specify a path in the 'after'
parameter. Whatever I specify , it either doesn't show up or only shows
in the first level (e.g. 'additions'). Does anyone know how this works?

TIA,
Rüdiger
Re: How to define a org.eclipse.ui.menus contribution for sub-context-menus [message #841607 is a reply to message #841454] Wed, 11 April 2012 14:36 Go to previous messageGo to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
I think you specify the ID of the submenu rather than org.eclipse.popup.ui.any, e.g.

popup:compareWithMenu

If you want to place your menu item before or after a specific submenu item, use its ID, e.g.

popup:compareWithMenu?after=org.eclipse.team.ui.compareLocalHistory

What I do find confusing though is that Menu Spy (ALT+SHIFT+F2) reports the locationURIs for those context menu items as:

menu:compareWithMenu?after=org.eclipse.team.ui.compareLocalHistory

I thought the "menu" scheme was for the view's local pulldown menu?

Craig
Re: How to define a org.eclipse.ui.menus contribution for sub-context-menus [message #842467 is a reply to message #841607] Thu, 12 April 2012 10:17 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
Craig,

thanks for you reply. I tried all of your suggestions, plus some more:
menu:compareWithMenu / menu:compareWithGroup
popup:compareWithMenu / popup:compareWithGroup
All of them with and without ?before/after. But none of them work. To
make sure that the command/handler itself works, I placed it at
'popup:org.eclipse.ui.popup.any?after=additions' which works. But that's
not where I want to show the command.

Do you succeed in contributing something to the compareWith menu?
May there be a bug that prevents my contribution from showing?
Any other ideas?

Regards,
Rüdiger

On 11.04.2012 16:36, Craig Foote wrote:
> I think you specify the ID of the submenu rather than
> org.eclipse.popup.ui.any, e.g.
>
> popup:compareWithMenu
>
> If you want to place your menu item before or after a specific submenu
> item, use its ID, e.g.
>
> popup:compareWithMenu?after=org.eclipse.team.ui.compareLocalHistory
>
> What I do find confusing though is that Menu Spy (ALT+SHIFT+F2) reports
> the locationURIs for those context menu items as:
>
> menu:compareWithMenu?after=org.eclipse.team.ui.compareLocalHistory
>
> I thought the "menu" scheme was for the view's local pulldown menu?
>
> Craig
Re: How to define a org.eclipse.ui.menus contribution for sub-context-menus [message #855074 is a reply to message #842467] Tue, 24 April 2012 13:53 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Craig, that's probably just plugin spy by default puts menu: at the beginning of whatever it discovers. Sounds like it could use a but report.

Rüdiger, popup menus have contributions added 1) programmatically, 2) by o.e.ui.menus, and then 3) by o.e.ui.popupMenus. Your o.e.ui.menus contributions can't see the popupMenus contributions.

PW


Re: How to define a org.eclipse.ui.menus contribution for sub-context-menus [message #855176 is a reply to message #855074] Tue, 24 April 2012 15:26 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
On 24.04.2012 15:53, Paul Webster wrote:
> Craig, that's probably just plugin spy by default puts menu: at the
> beginning of whatever it discovers. Sounds like it could use a but report.
>
> Rüdiger, popup menus have contributions added 1) programmatically, 2) by
> o.e.ui.menus, and then 3) by o.e.ui.popupMenus. Your o.e.ui.menus
> contributions can't see the popupMenus contributions.
Thanks for your reply, Paul. But I don't quite understand your answer.
o.e.ui.menus is what I try to use.
Maybe my initial post wasn't clear. I am trying to convert an old school
popupMenus object-contribution to a new-style menus contribution. The
popupMenus menubarPath was 'compareWithMenu/compareWithGroup', but I
can't find out how to express that with the o.e.ui.menus extension.
I am able to place the menu contribution into the top-level menu (e.g.
locationURI="menu:org.eclipse.ui.popup.any?after=additions") but not
into the 'Compare with' submenu.

>
> PW
>
Re: How to define a org.eclipse.ui.menus contribution for sub-context-menus [message #855341 is a reply to message #855176] Tue, 24 April 2012 18:31 Go to previous messageGo to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
Ah, so the "compareWith" submenu is contributed by the old "popupMenu" extension and we've been trying to contribute to it using the newer "menus" extension which can't find it because of some incompatibility?

So I guess to add to "compareWith" we need to either use another "popupMenu" extension or programmatically add to it?

I've been meaning to ask, is the Common Navigator Framework going to be updated to use the Command Framework rather than popupMenu extensions and Actions? Same for PropertySheet?

Craig

[Updated on: Tue, 24 April 2012 18:34]

Report message to a moderator

Re: How to define a org.eclipse.ui.menus contribution for sub-context-menus [message #856111 is a reply to message #855176] Wed, 25 April 2012 11:32 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Rüdiger Herrmann wrote on Tue, 24 April 2012 11:26
On 24.04.2012 15:53,
Thanks for your reply, Paul. But I don't quite understand your answer.
o.e.ui.menus is what I try to use.
Maybe my initial post wasn't clear. I am trying to convert an old school
popupMenus object-contribution to a new-style menus contribution. The
popupMenus menubarPath was 'compareWithMenu/compareWithGroup', but I
can't find out how to express that with the o.e.ui.menus extension.
I am able to place the menu contribution into the top-level menu (e.g.
locationURI="menu:org.eclipse.ui.popup.any?after=additions") but not
into the 'Compare with' submenu.


I'm saying that contributions from o.e.ui.menus cannot see contributions from o.e.ui.popupMenus/objectContribution, because menus is applied before popupMenus. This is by design, as all the action extension points were very limited in placement,scope, and lifecycle.

Using o.e.ui.menus to contribute to the Team submenu works because they also contribute the same structure thought o.e.ui.menus (the framework merges their objectContributions into the Team menu for them).

PW


Re: How to define a org.eclipse.ui.menus contribution for sub-context-menus [message #856116 is a reply to message #855341] Wed, 25 April 2012 11:34 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Craig Foote wrote on Tue, 24 April 2012 14:31
So I guess to add to "compareWith" we need to either use another "popupMenu" extension or programmatically add to it?



Or contribute the skeleton of the compareWith menu and all of its separators using o.e.ui.menus.

The correct matching locationURI is popup:compareWithMenu?after=compareWithGroup

Quote:


I've been meaning to ask, is the Common Navigator Framework going to be updated to use the Command Framework rather than popupMenu extensions and Actions? Same for PropertySheet?


That would be ideal, but probably not. AFAIK no one is looking at the CNF at the moment.

PW


Previous Topic:What is R3_6_maintenance_Java7 branch
Next Topic:How can I register a paste command handler in PageDesignerEditor?
Goto Forum:
  


Current Time: Fri Apr 19 07:47:14 GMT 2024

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

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

Back to the top