Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Q regarding order of contributed menus to popup menus
Q regarding order of contributed menus to popup menus [message #331698] Wed, 17 September 2008 06:33 Go to next message
Eclipse UserFriend
Originally posted by: no.ddress.now

So I am able to add a menu to the JDT Editor and Outline popup menus
and, functionally, they work.

The problem is that the menu location in the popup menu is not
consistant for path="group.show". For the JDT Editor, my menu is being
added immeditely *above* "Show In" and for the JDT Outline, it is
immediately *below* "Show In".

If I specify path="additions" for both, then my menu shows up
immediately above "Run" in the JDT Editor popup menu and immediately
below "Restore from local history" in the Outline popup menu.

Is there a way to enforce/ensure consistent placement of my menu? Or,
is there something incorrect about my configuration?

<extension
point="org.eclipse.ui.popupMenus">
<viewerContribution
id="net.certiv.visualization.cgv.callgraphActions"
targetID="#CompilationUnitEditorContext">
<menu
id="callGraphEditorMenu"
label="Call Graph"
path="group.show">
<separator name="group1" />
</menu>
<action
...
</action>
</viewerContribution>

<objectContribution
adaptable="false"
id="net.certiv.visualization.cgv.callgraphActions1"
objectClass="org.eclipse.jdt.core.IMember">
<menu
id="callGraphViewMenu"
label="Call Graph"
path="group.show">
<separator name="group2" />
</menu>
<action
...
</action>
</objectContribution>
</extension>

Thanks,
Gerald
Re: Q regarding order of contributed menus to popup menus [message #331724 is a reply to message #331698] Thu, 18 September 2008 14:05 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Gerald Rosenberg wrote:
> Is there a way to enforce/ensure consistent placement of my menu? Or,
> is there something incorrect about my configuration?

With object and viewer contributions, the order of processing is
non-deterministic. You can only work around this by using groups to
specify order, but 2 contributions at the same "group" can be added in
any order (that includes your menu vs the Show In menu).

There are some potential hacks available in 3.3 and 3.4, but I'm not
sure if they are a good idea.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: Q regarding order of contributed menus to popup menus [message #331728 is a reply to message #331724] Thu, 18 September 2008 14:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: no.ddress.now

In article <gatnis$fj6$1@build.eclipse.org>, pwebster@ca.ibm.com
says...
> Gerald Rosenberg wrote:
> > Is there a way to enforce/ensure consistent placement of my menu? Or,
> > is there something incorrect about my configuration?
>
> With object and viewer contributions, the order of processing is
> non-deterministic. You can only work around this by using groups to
> specify order, but 2 contributions at the same "group" can be added in
> any order (that includes your menu vs the Show In menu).
>
> There are some potential hacks available in 3.3 and 3.4, but I'm not
> sure if they are a good idea.
>
> PW

Thanks, Paul.

Is there any documentation at all on the 3.4 hack? Not sure which is
worse, the hack or having UI elements show in inconsistant locations.

Best,
Gerald
Re: Q regarding order of contributed menus to popup menus [message #331735 is a reply to message #331728] Thu, 18 September 2008 17:35 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Gerald Rosenberg wrote:
> Thanks, Paul.
>
> Is there any documentation at all on the 3.4 hack? Not sure which is
> worse, the hack or having UI elements show in inconsistant locations.
>

Just that menu contributions are applied before action contributions.
You could use a menu contribution to insert 2 or 3 groups, which would
hopefully help control where the menu shows up:

ex:
<menuContribution
locationURI="popup:#CompilationUnitEditorContext?after=group.show ">
<separator name="my.group1" visible="false"/>
<separator name="my.group2" visible="false"/>
</menuContribution>

// you can target your objectContribution-equivalent specifically at the
outline view or at all views:
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=group.show "
<separator name="my.group1" visible="false"/>
<separator name="my.group2" visible="false"/>
</menuContribution>


Your groups will show up before any action contributions
(viewerContribution or objectContribution) is applied, and that should
help with the ordering.

It won't help if one of the scenarios is added programmatically.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: Q regarding order of contributed menus to popup menus [message #331736 is a reply to message #331735] Thu, 18 September 2008 17:40 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Paul Webster wrote:
> ex:
> <menuContribution
> locationURI="popup:#CompilationUnitEditorContext?after=group.show ">
> <separator name="my.group1" visible="false"/>
> <separator name="my.group2" visible="false"/>
> </menuContribution>
>
> // you can target your objectContribution-equivalent specifically at the
> outline view or at all views:
> <menuContribution
> locationURI="popup:org.eclipse.ui.popup.any?after=group.show "
> <separator name="my.group1" visible="false"/>
> <separator name="my.group2" visible="false"/>
> </menuContribution>
>

You might have to play around with the popup.any contribution, or
potentially only use it (as opposed to 2)

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:problem aligning both image/text inside a button
Next Topic:Action enablement into a Popup menu with submenus
Goto Forum:
  


Current Time: Sat Nov 02 17:04:35 GMT 2024

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

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

Back to the top