Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 130425 - [Contributions] visible/enabled: popupMenu not showing objectContribution menus if no action added first
Summary: [Contributions] visible/enabled: popupMenu not showing objectContribution men...
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: Douglas Pollock CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-04 01:06 EST by Eric DeBolle CLA
Modified: 2006-03-06 19:12 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-04 01:06:30 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-06 10:04:34 EST
I believe this is duplicate of Bug 128293.  Could you try making the change in Bug 128293 comment #4, and let me know if it works for you?
Comment 2 Eric DeBolle CLA 2006-03-06 18:40:39 EST
If you mean for me to rebuild the org.eclipse.jface_3.2....jar using that fix, then yes, it does work for me.

I'm not sure how other developers are going to get this fix into their dev environments. I tried making a fragment for org.eclipse.jface and including that fragment during the PDE startup of my RCP but that didn't have the desired effect. But I guess this is my problem now.

Is it too late to get this SubMenuManager fix into 3.2?

Thanks Doug

FYI: Marking this bug as dup of 128293

*** This bug has been marked as a duplicate of 128293 ***
Comment 3 Douglas Pollock CLA 2006-03-06 19:12:56 EST
There will almost definitely be a fix for 3.2.  I'm just trying to move cautiously, as this is one of those "brittle" areas in the workbench layer.  (A lot of downstream code depend on this code working in a very particular way.)