Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pde-dev] Creating submenus for a pop-up menu


Thanks Jim,









"Jim D'Anjou" <danjou@xxxxxxxxxx>

Sent by:
pde-dev-admin@xxxxxxxxxxx

03/10/2005 02:43 AM
Please respond to pde-dev

       
        To:        pde-dev@xxxxxxxxxxx
        cc:        pde-dev@xxxxxxxxxxx
pde-dev-admin@xxxxxxxxxxx
(bcc: Roopa Mahishi/BTC/SC/PHILIPS)

        Subject:        Re: [pde-dev] Creating submenus for a pop-up menu

        Classification:        




Roopa, this is a common source of confusion. Here is an example that works (thanks to John Arthorne, co-author of Official Eclipse 3.0 FAQs www.eclipsefaq.org).

All menu "path" attributes must be of the form "menuPath/group", where "menuPath" can be any number of nested menus. So the path "
sampleMenu/subMenu/subSubMenu/sampleGroup" will put an action in a doubly-nested sub menu. Below is a complete example:

<extension
point=
"org.eclipse.ui.actionSets">
<actionSet
label=
"Profile UI Job"
visible=
"true"
id=
"org.eclipse.uijob.perf.actionSet">
<menu
label=
"Profile UI Job"
id=
"sampleMenu">
<separator
name=
"sampleGroup">
</separator>
</menu>
<menu
label=
"SubMenu1"
path=
"sampleMenu/sampleGroup"
id=
"subMenu">
<separator
name=
"sampleGroup">
</separator>
</menu>
<menu
label=
"SubSubMenu"
path=
"sampleMenu/subMenu/sampleGroup"
id=
"subSubMenu">
<separator
name=
"sampleGroup">
</separator>
</menu>
<action
label=
"Profile UI Job"
icon=
"icons/sample.gif"
class=
"org.eclipse.uijob.perf.actions.SampleAction"
tooltip=
"Profile UI Job"
menubarPath=
"sampleMenu/subMenu/subSubMenu/sampleGroup"
id=
"org.eclipse.uijob.perf.actions.SampleAction">
</action>
</actionSet>
</extension>


This produces:





Jim D'Anjou
The Java Developer's Guide to Eclipse, Second Edition -
http://www.jdg2e.com
Ready for Rational Software partner program -
http://www.developer.ibm.com/rational/readyfor.html
Inactive hide details for roopa.mahishi@xxxxxxxxxxxroopa.mahishi@xxxxxxxxxxx

roopa.mahishi@xxxxxxxxxxx
Sent by: pde-dev-admin@xxxxxxxxxxx

03/08/2005 12:32 AM

Please respond to
pde-dev



To

pde-dev@xxxxxxxxxxx

cc

Subject

[pde-dev] Creating submenus for a pop-up menu





I want to create submenus for the following action as:


New Pop-up Menu --> Action1 --> SubMenu Action1

Action2 --> SubMenu Action2

For action1
menubarPath is the Id of "New Pop-up Menu" and the seperator i.e newmenu.menu1/group1
Similarly for action2.


On the same analogy, I'm adding the id of Action1 to menubarPath of "SubMenu Action1" , so that a submenu for action1 is created.

Is this addition of menu/submenus correct?I'm not able to get the menu and sub-menus as I want it as mentioned above.

Can someone give me a hint to solve the problem..?

Here is the plug-in.xml file contents:

<extension

point=
"org.eclipse.ui.popupMenus">
<objectContribution

objectClass=
"org.eclipse.core.resources.IFile"
nameFilter=
"plugin.xml"
id=
"submenu.contribution1">
<menu

label=
"New Pop-up Menu"
path=
"additions"
id=
"newmenu.menu1">
<separator

name=
"group1">
</separator>

<separator
name="group2"/>
</menu>

<action

label=
"Action2"
menubarPath=
"newmenu.menu1/group1"
id=
"menu.action2"/>
<action

label=
"Action1"
menubarPath=
"newmenu.menu1/group1"
enablesFor=
"1"
id=
"menu.action1">
</action>

<action

label=
"Submenu Action1"
class=
"submenu.Action3"
menubarPath=
"menu.action1/group2"
id=
"submenu.action1"/>
<action

label=
"Submenu Action2"
class=
"submenu.Action4"
id=
"submenu.action2"/>
</objectContribution>

</extension>


Rgds,

Roopa


Back to the top