Bug 36389 - [Contributions] interactions: Unable to reference menu defined in another actionSet within the same plugin.xml
Summary: [Contributions] interactions: Unable to reference menu defined in another act...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: 3.3   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 98061 98912 103203 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-04-10 21:18 EDT by lhao CLA
Modified: 2007-06-20 13:07 EDT (History)
8 users (show)

See Also:


Attachments
Sample jar file (7.66 KB, application/x-zip-compressed)
2003-04-22 13:25 EDT, lhao CLA
no flags Details
Plugin.xml see note for 5/8/2003 (2.40 KB, text/xml)
2003-05-09 15:40 EDT, lhao CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description lhao CLA 2003-04-10 21:18:13 EDT
Invalid Menu Extension (Path is invalid) error with the following sniplet from 
my plugin.xml.

I added an "Mine" top level menu with "Launch" action in the actionSets
extension; "Launch" is not specific to any particular view or editor.  Then
I added a "Publish" action to the CompilationUnitEditor and I would like
that to show up after the "Launch" menu. 

It's not acceptable to duplicate the menu in the second actionSets (as 
suggested workaround for bug 15670) because the top level menu needs to be 
enabled at all times.  

Please suggest a workaround for this problem.

 <extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            label="My Action Set"
            visible="true"
            id="com.my.eclipse.actionSet">
         <menu
               label="Mine"
               id="myMenu">
            <separator
                  name="myLaunch">
            </separator>
            <separator
                  name="myPublish">
            </separator>
         </menu>
         <action
               label="Launch"
               icon="icons/launch.gif"
               tooltip="Launch"
               class="com.my.eclipse.actions.LaunchAction"
               menubarPath="myMenu/myLaunch"
               toolbarPath="additional"
               id="com.my.eclipse.actions.LaunchAction">
         </action>
      </actionSet>
   </extension>

 <extension
   point="org.eclipse.ui.editorActions">
    <editorContribution
   targetID="org.eclipse.jdt.ui.CompilationUnitEditor"
   id="com.my.eclipse.publishMenu">
  <!-- does not work, Mine/Launch menu is disabled
         <menu
               label="Mine"
               id="myMenu">
            <separator
                  name="myLaunch">
            </separator>
            <separator
                  name="myPublish">
            </separator>
         </menu>
         -->
    <action
    label="Publish"
    icon="icons/publish.gif"
    class="com.my.eclipse.actions.PublishActionPopup"
    tooltip="Publish"
       menubarPath="myMenu/myPublish"
             id="com.my.eclipse.actions.PublishAction">
    </action>
    </editorContribution>
 </extension>
Comment 1 Dejan Glozic CLA 2003-04-11 11:42:06 EDT
Platform UI
Comment 2 Simon Arsenault CLA 2003-04-11 15:57:40 EDT
Can you please provide a sample plugin to reproduce this problem, and the steps 
to reproduce it.
Comment 3 Simon Arsenault CLA 2003-04-21 13:41:52 EDT
No responce, closing.
Comment 4 lhao CLA 2003-04-22 13:25:41 EDT
Created attachment 4669 [details]
Sample jar file

Sorry it took me so long to create this test case.  Please reopen this bug.  

Steps to reproduce.
1. Unzip jar file into plugin
2. Customize Perspective, make sure "My Action Set" is checked.
3. Open any java file, there should be an error message in the .log file
Comment 5 Simon Arsenault CLA 2003-05-05 15:26:46 EDT
Reopening so as to investigate reproducable test as time permits.
Comment 6 Simon Arsenault CLA 2003-05-09 12:39:59 EDT
If I install the plugin as you sent it (with the menu element commented out for 
the org.eclipse.ui.editorActions contribution extension point), and follow your 
steps, it works. If I uncheck the action set, then open the java editor, then I 
get the error message - and that makes sense since no menu element was defined.

If I uncomment the menu element in the plugin.xml file, and follow your steps 
again, all works fine. Even if I switch to the nav view, the Mine > Launch is 
enabled, and Mine > Publish is disabled.

The only time I got Mine > Launch to become disabled was if I open the Java 
editor then checked the action set. In that case, switching to the nav view 
caused the Mine > Launch to be disabled too.

Can you confirm that my findings are the same as yours? I will investigate the 
issue above with Mine > Launch being disabled.
Comment 7 lhao CLA 2003-05-09 15:40:45 EDT
Created attachment 4840 [details]
Plugin.xml see note for 5/8/2003
Comment 8 lhao CLA 2003-05-09 15:40:57 EDT
Yes, that's what I'm seeing too.  The Mine > Launch menu should be enabled at 
all times.

Regarding your first paragraph, the error message does not make any sense to 
me.  If I replace the menubarPath="file/save.ext" instead of  
menubarPath="myMenu/myPublish", the action would work as expected.  In both 
cases, I didn't define any menu element.  This leads me to believe that I've 
defined an invalid menubatPath. If you use the attached plugin.xml (or just 
comment out action block with "Error message", and uncomment the action block 
with "This will work") hopefully you'll see what I'm babbling about.

Thank you so much for reopening this bug.  And thank you for the excellent 
article on "Contributing Actions to the Eclipse Workbench". 
Comment 9 Simon Arsenault CLA 2003-05-12 11:15:21 EDT
If you use "file/save.ext", that menu path already exists because the workbench 
predefines this group. For your "myMenu/myPublish", you need to include a menu 
element to define this menu path to the workbench before you can use it in the 
menubarPath attribute of your action.

Without going into implementation detail, the main problem is with one or more 
plugins trying to use the same menu element. It was never designed for that but 
it works...almost.

We (ui team) are really pushing to fix up the whole action contribution story 
in the 3.0 release. It will unfortunately require API/behavior changes...the 
battle now if whether the benefits outway the cost (i.e. broken plugins).
Comment 10 Simon Arsenault CLA 2003-05-12 12:32:33 EDT
No further work will be done on this until decision is made on action 
contribution work for 3.0 plan.

Impl Note: When the editor is the first to contribute the menu definition, it 
owns the sub menu manager. Therefore, when Nav view gets focus, the editor 
tells the sub menu manager to disabled itself, causing all the items to become 
disabled...including the items contributed by the action set.
Comment 11 lhao CLA 2003-05-12 14:10:51 EDT
Thank for explaination.  I look forward to hear more information on the 3.0 
plans.
Comment 12 Nick Edgar CLA 2005-06-03 10:02:10 EDT
*** Bug 98061 has been marked as a duplicate of this bug. ***
Comment 13 Nick Edgar CLA 2005-06-08 10:25:15 EDT
*** Bug 98912 has been marked as a duplicate of this bug. ***
Comment 14 Nick Edgar CLA 2005-07-11 12:58:58 EDT
*** Bug 103203 has been marked as a duplicate of this bug. ***
Comment 15 Michael Van Meekeren CLA 2006-04-21 13:56:27 EDT
Moving Dougs bugs
Comment 16 Bryan Solan CLA 2006-07-12 11:37:55 EDT
I found what seems to be an identical problem to this. However I was able to work around it solely by changing the id of the actionSet which contributes the item to the menu.
Comment 17 Paul Webster CLA 2007-04-05 19:02:12 EDT
Assigning to component owner
PW
Comment 18 Paul Webster CLA 2007-06-20 13:07:35 EDT
This item has been fixed/superceded by the menu contribution mechanism - bug 154130