menubarPath -- Did this function change in 3.1? [message #286256] |
Mon, 06 June 2005 09:20  |
Eclipse User |
|
|
|
Originally posted by: gary.karasiuk.com
In 3.0.2, I was able to have one plug-in add menu items to another plug-ins
menu.
Here is a fragment from the plug.xml of the plug-in that is being extended:
<extension point="org.eclipse.ui.actionSets">
<actionSet label="%ActionSet.label" visible="true"
id="org.eclipse.perfmsr.ui.actions">
<menu
label="%Menu.label"
id="org.eclipse.perfmsr.menu">
<separator name="snapshots"></separator>
<separator name="all"></separator>
<separator name="other"></separator>
<!-- This group can be extended by other plugins. -->
<separator name="additions"></separator>
</menu>
And here is a fragment from the plugin.xml that is trying to add some
additional menu items:
<action
label="%OpenSnapshots.label"
tooltip="%OpenSnapshots.tootip"
class=" org.eclipse.perfmsr.ui.client.OpenSnapshotsViewActionDelegat e "
menubarPath="org.eclipse.perfmsr.menu/additions"
id="org.eclipse.perfmsr.ui.client.opensnapshotsview">
</action>
Am I doing something wrong? In 31RC1 I now get:
Invalid Menu Extension (Path is invalid):
org.eclipse.perfmsr.ui.client.opensnapshotsview
|
|
|
|
|
Re: menubarPath -- Did this function change in 3.1? [message #286430 is a reply to message #286401] |
Thu, 09 June 2005 09:24  |
Eclipse User |
|
|
|
Another related piece of inconsistent behavior is dealing with popup
menus. I am able to create a new sub-menu in an <objectContribution> in
one plug-in and add actions to that sub-menu from an
<objectContribution> of another plug-in. But, I cannot add a
sub-sub-menu to that sub-menu from another plug-in, which doesn't make a
lot sense.
That is the following works:
=== Start ===
first plugin.xml
-----------------
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.core.resources.IFile"
id="edu.cmu.sei.osate.ui.actions.Aadl1">
<menu
label="%popupMenus.aadl.label"
path="additions"
id="popupMenu.Aadl">
<groupMarker name="basic.grp"/>
<separator name="contributed.grp"/>
</menu>
<menu
label="Schedule"
path="popupMenu.Aadl/contributed.grp"
id="rsrc.popup">
<groupMarker name="top.grp"/>
</menu>
</objectContribution>
<objectContribution
objectClass="org.eclipse.core.resources.IFile"
id="edu.cmu.sei.osate.ui.actions.Aadl">
<visibility> ... </visibility>
<action
label="&Remove Problem Markers"
icon="icons/none.gif"
tooltip="Remove problem markers from file"
class="edu.cmu.sei.osate.ui.actions.ResetMarkers"
menubarPath="popupMenu.Aadl/basic.grp"
enablesFor="1"
id="edu.cmu.sei.osate.ui.actions.ResetMarkers"/>
</objectContribution>
</extension>
second plugin.xml
------------------
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.core.resources.IFile"
id="edu.cmu.sei.osate.ui.actions.Aadl2">
<action
id="resourcemanagement.actions.CheckPriorityInversion"
class=" edu.cmu.sei.aadl.resourcemanagement.actions.CheckPriorityInv ersion "
enablesFor="1"
icon="icons/inversion.gif"
label="&Check Priority Inversion"
menubarPath="popupMenu.Aadl/rsrc.popup/top.grp"/>
</objectContribution>
</extension>
=== End ===
But the following does not work. I get an "invalid path" error when I
try to add the "Schedule" menu from the second plugin.xml, and
naturally, an "invalid path" error on the action as well.
=== Start ===
first plugin.xml
-----------------
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.core.resources.IFile"
id="edu.cmu.sei.osate.ui.actions.Aadl1">
<menu
label="%popupMenus.aadl.label"
path="additions"
id="popupMenu.Aadl">
<groupMarker name="basic.grp"/>
<separator name="contributed.grp"/>
</menu>
</objectContribution>
</extension>
second plugin.xml
------------------
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.core.resources.IFile"
id="edu.cmu.sei.osate.ui.actions.Aadl">
<visibility>
<objectState name="extension" value="aaxl"/>
</visibility>
<menu
label="Schedule"
path="popupMenu.Aadl/contributed.grp"
id="rsrc.popup">
<groupMarker name="top.grp"/>
</menu>
<action
id="resourcemanagement.actions.CheckPriorityInversion"
class=" edu.cmu.sei.aadl.resourcemanagement.actions.CheckPriorityInv ersion "
enablesFor="1"
icon="icons/inversion.gif"
label="&Check Priority Inversion"
menubarPath="popupMenu.Aadl/rsrc.popup/top.grp"/>
</objectContribution>
</extension>
=== End ===
All of this seems completely turned-around to me because it requires the
original plug-in to predict exactly what menus any subsequent plug-ins
might want to use. This is not how extensibility should work. Even the
whole idea that the menubarPath should contain the complete menu
hierarchy is wrong, it seems. A menu should exist and have a unique
identifier. When I create that menu I should be able to put it inside
of another menu by referencing that menus unique id, but I shouldn't
have to care where that other menu is located. That is, menus and
actions sould be placed inside of other menus by referencing the unique
id of that menu plus the group id only.
|
|
|
Powered by
FUDForum. Page generated in 0.05191 seconds