Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 130785 - popupMenu not showing objectContribution menus if no action added first
Summary: popupMenu not showing objectContribution menus if no action added first
Status: RESOLVED DUPLICATE of bug 128293
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: Other Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-07 14:40 EST by Eric DeBolle CLA
Modified: 2006-03-07 15:31 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric DeBolle CLA 2006-03-07 14:40:22 EST
I found that on Eclipse 3.1.1 and 3.2M5a popupMenus do not show menus created via the popupMenus extension via an objectContribution unless a menu action was first placed in the menu manager via code. I did not test this on any other OS.


If I create a popupMenu in a View like this:

MenuManager contextMenuMgr = new MenuManager("#PopupMenu");
Action action = new Action() { public void run() { ; } };
action.setText("Why does this have to be here to see other menus?");
// contextMenuMgr.add(action);
contextMenuMgr.add(
   new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
Menu menu = contextMenuMgr.createContextMenu(
   this.treeViewer.getControl());
this.treeViewer.getControl().setMenu(menu);
this.getSite().registerContextMenu(contextMenuMgr, this.treeViewer);


And have plugin.xml like this:
   <extension
         point="org.eclipse.ui.popupMenus">
      <objectContribution
            id="com.xyz.C1"
            objectClass="java.lang.String">
         <menu
               id="com.xyz.xyzMenu"
               label="Menu"
               path="additions">
            <separator name="group1"/>
         </menu>
         <action
               class="com.xyz.action.NewAction"
               id="com.xyz.actions.menuAction"
               label="Action in Menu"
               menubarPath="com.xyz.xyzMenu/group1"/>
         <action
               class="com.xyz.action.NewAction"
               id="com.xyz.actions.additionAction"
               label="Action in Additions"
               menubarPath="additions"/>
      </objectContribution>
   </extension>


I will not see the menu lableled 'Menu' and thus be missing the action labeled 'Action in Menu'. But I will see the action labeled 'Action in Additions'.

However if I uncomment the line in the above code
  contextMenuMgr.add(action);
I will see the menu, it's action and the other action.
Comment 1 Douglas Pollock CLA 2006-03-07 14:47:23 EST
Is this a dupe of 130425 (which is a dupe of 128293)?

*** This bug has been marked as a duplicate of 128293 ***
Comment 2 Eric DeBolle CLA 2006-03-07 15:31:51 EST
Yes it is a dup, sorry about that. I clicked something in the browser window left open from the original bug submission and accidently/stupidly answered "OK" to the "REPOST INFO" browser dialog.

Anyway, I'll test the build of I20060314-0800.

thanks