Bug 105949 - [ActionSets] Problem with ActionSets
Summary: [ActionSets] Problem with ActionSets
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2 M1   Edit
Assignee: Douglas Pollock CLA
QA Contact:
URL:
Whiteboard:
Keywords: Documentation
Depends on:
Blocks:
 
Reported: 2005-08-03 14:05 EDT by Anthony Hunter CLA
Modified: 2006-09-11 03:36 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Hunter CLA 2005-08-03 14:05:38 EDT
Create a hello world plug-in called test.

Make the ActionSet extension point look like:

   <extension point="org.eclipse.ui.actionSets">
      <actionSet
            label="Sample Action Set One"
            visible="true"
            id="test.actionSet">
         <menu
               label="Sample &amp;Menu"
               id="sampleMenu">
            <separator
                  name="sampleGroup">
            </separator>
            <separator
                  name="sampleGroup2">
            </separator>
         </menu>
         <menu
               label="Sample Menu &amp;Two"
               path="sampleMenu/sampleGroup2"
               id="sampleMenu2">
            <separator
                  name="sampleGroup22">
            </separator>
         </menu>
         <action
               label="&amp;Sample Action"
               icon="icons/sample.gif"
               class="test.actions.SampleAction"
               tooltip="Hello, Eclipse world"
               menubarPath="sampleMenu/sampleGroup"
               id="test.actions.SampleAction">
         </action>
         <action
               label="&amp;Sample Action Two"
               icon="icons/sample.gif"
               class="test.actions.SampleAction"
               tooltip="Hello, Eclipse world"
               menubarPath="sampleMenu/sampleMenu2/sampleGroup22"
               id="test2.actions.SampleAction">
         </action>
      </actionSet>
   </extension>

This will give you a new "Sample Menu" in the main menu and a "Sample Action" item.
It also has a submenu "Sample Menu Two" with a "Sample Action Two" item.

Now create a second hello world plug-in called test2.

We want to move the contribution of "Sample Menu Two" to this other plug-in.

test ActionSet extension point now looks like:
   <extension point="org.eclipse.ui.actionSets">
      <actionSet
            label="Sample Action Set One"
            visible="true"
            id="test.actionSet">
         <menu
               label="Sample &amp;Menu"
               id="sampleMenu">
            <separator
                  name="sampleGroup">
            </separator>
            <separator
                  name="sampleGroup2">
            </separator>
         </menu>
         <action
               label="&amp;Sample Action"
               icon="icons/sample.gif"
               class="test.actions.SampleAction"
               tooltip="Hello, Eclipse world"
               menubarPath="sampleMenu/sampleGroup"
               id="test.actions.SampleAction">
         </action>
      </actionSet>
   </extension>

test2 ActionSet extension point looks like:
   <extension point="org.eclipse.ui.actionSets">
      <actionSet
            label="Sample Action Set Two"
            visible="true"
            id="test2.actionSet">
         <menu
               label="Sample Menu &amp;Two"
               path="sampleMenu/sampleGroup2"
               id="sampleMenu2">
            <separator
                  name="sampleGroup22">
            </separator>
         </menu>
         <action
               label="&amp;Sample Action Two"
               icon="icons/sample.gif"
               class="test2.actions.SampleAction"
               tooltip="Hello, Eclipse world"
               menubarPath="sampleMenu/sampleMenu2/sampleGroup22"
               id="test2.actions.SampleAction">
         </action>
      </actionSet>
   </extension>

When you run, you get errors:
!ENTRY org.eclipse.ui 4 4 2005-08-03 13:57:43.459
!MESSAGE Invalid Menu Extension (Path is invalid): sampleMenu2

!ENTRY org.eclipse.ui 4 4 2005-08-03 13:57:43.462
!MESSAGE Invalid Menu Extension (Path is invalid): test2.actions.SampleAction

If you replace the menu path with "window/additions" in test2, as in:
   <extension point="org.eclipse.ui.actionSets">
      <actionSet
            label="Sample Action Set Two"
            visible="true"
            id="test2.actionSet">
         <menu
               label="Sample Menu &amp;Two"
               path="window/additions"
               id="sampleMenu2">
            <separator
                  name="sampleGroup22">
            </separator>
         </menu>
         <action
               label="&amp;Sample Action Two"
               icon="icons/sample.gif"
               class="test2.actions.SampleAction"
               tooltip="Hello, Eclipse world"
               menubarPath="window/sampleMenu2/sampleGroup22"
               id="test2.actions.SampleAction">
         </action>
      </actionSet>
   </extension>

The ActionSet works fine.
Comment 1 Douglas Pollock CLA 2005-08-03 14:33:04 EDT
This is a question for the newsgroups. 
Comment 2 Anthony Hunter CLA 2005-08-08 13:31:47 EDT
I asked a question to eclipse.platform a week ago, no answer.

I believe this is either a bug or an undocumentated limitation of ActionsSets.
Comment 3 Douglas Pollock CLA 2005-08-09 10:58:47 EDT
"the location of the new menu starting from the root of the menu. Each token   
in the path must refer to an existing menu, except the last token which should   
represent a named group in the last menu in the path. If omitted, the new menu   
will be added to the additions named group of the menu."   
   
The key here is that the menu must exist.  There is no dependency mechanism 
for action sets and we don't do automatic dependency detection.  So, this 
leads to a situation where test2's action set can come into existence before 
test's action set.  If this happens, then test2's action set will be found to 
reference a non-existent menu. 
 
You should take a look at Bug 36389, in particular Bug 36839 comment #9.  
Also, you might want to check out Bug 16282 comment #14, Bug 16282 comment #15 
and Bug 16282 comment #16. 
 
Comment 4 Douglas Pollock CLA 2005-08-09 11:13:06 EDT
Okay, I've added a note to this effect in the extension point documentation. 
 
Comment 5 Douglas Pollock CLA 2005-08-10 12:09:48 EDT
Verified that this appears in the help.