Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » path in editor menus
path in editor menus [message #336078] Wed, 20 May 2009 01:24 Go to next message
Williams Mising name is currently offline Williams Mising nameFriend
Messages: 43
Registered: July 2009
Member
In Extension Points Reference Menus for Editor Munus, Toolbars and
Actions, I find the following description for munu:

<!ELEMENT menu (separator* , groupMarker*)>

<!ATTLIST menu

id CDATA #REQUIRED

label CDATA #REQUIRED

path CDATA #IMPLIED>


This element is used to defined a new menu.



id - a unique identifier that can be used to reference this menu.
label - a translatable name used by the Workbench for this new menu. The
name should include mnemonic information.
path - 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.

Can some explain path in details based on the following example:

<menu
label="%_UI_ValidationMenu_label"
path="org.eclipse.example.loyaltyMenuID/additions"
id="org.eclipse.emf.validationMenuID">
<separator name="additions"/>
</menu>

So org.eclipse.example.loyaltyMenuId is an existing menu, where can I find
it? Thanks.
Will
Re: path in editor menus [message #336088 is a reply to message #336078] Wed, 20 May 2009 17:53 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Williams wrote:

> Can some explain path in details based on the following example:
>
> <menu
> label="%_UI_ValidationMenu_label"
> path="org.eclipse.example.loyaltyMenuID/additions"
> id="org.eclipse.emf.validationMenuID">
> <separator name="additions"/>
> </menu>
>
> So org.eclipse.example.loyaltyMenuId is an existing menu, where can I
> find it? Thanks.

That is defined somewhere else, in actionSets in the same contribution,
in popupMenus/objectContributions simply in another contribution.

ex:

<menu id="top" label="Top Menu" path="additions">
<separator name="additions"/>
</menu>

<menu id="sub" label="Sub Menu" path="top/additions">
<separator name="additions"/>
</menu>

<menu id="subsub" label="Sub Sub Menu" path="top/sub/additions">
<separator name="additions"/>
</menu>

This creates the cascading menu: Top Menu>Sub Menu>Sub Sub Menu

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: path in editor menus [message #336092 is a reply to message #336088] Wed, 20 May 2009 23:06 Go to previous messageGo to next message
Williams Mising name is currently offline Williams Mising nameFriend
Messages: 43
Registered: July 2009
Member
Paul Webster wrote:

> Williams wrote:

>> Can some explain path in details based on the following example:
>>
>> <menu
>> label="%_UI_ValidationMenu_label"
>> path="org.eclipse.example.loyaltyMenuID/additions"
>> id="org.eclipse.emf.validationMenuID">
>> <separator name="additions"/>
>> </menu>
>>
>> So org.eclipse.example.loyaltyMenuId is an existing menu, where can I
>> find it? Thanks.

> That is defined somewhere else, in actionSets in the same contribution,
> in popupMenus/objectContributions simply in another contribution.

I still get the confused about what you said here. In the description,
it says "path - the location of the new menu starting from the root of the
menu. Each token in the path must refer to an existing menu". I find
org.eclipse.example.loyaltyMenuId is shown in the menupath under action
element as follows:

<action
...

menubarPath=" org.eclipse.example.loyaltyMenuId/org.eclipse.emf.validation MunuID/additions "
...
</action>

So you mean org.eclipse.example.loyaltyMenuId is defined in the
menubarPath?

> ex:

> <menu id="top" label="Top Menu" path="additions">
> <separator name="additions"/>
> </menu>

> <menu id="sub" label="Sub Menu" path="top/additions">

Here top in the path refers to the id's value give in the first menu?
Or sth else? Thanks.
Will


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

> <menu id="subsub" label="Sub Sub Menu" path="top/sub/additions">
> <separator name="additions"/>
> </menu>

> This creates the cascading menu: Top Menu>Sub Menu>Sub Sub Menu

> PW
Re: path in editor menus [message #336101 is a reply to message #336088] Thu, 21 May 2009 13:17 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Paul Webster wrote:
>
> <menu id="top" label="Top Menu" path="additions">
> <separator name="additions"/>
> </menu>
>
> <menu id="sub" label="Sub Menu" path="top/additions">
> <separator name="additions"/>
> </menu>
>
> <menu id="subsub" label="Sub Sub Menu" path="top/sub/additions">
> <separator name="additions"/>
> </menu>
>
> This creates the cascading menu: Top Menu>Sub Menu>Sub Sub Menu

First it defines "Top Menu" with an id of "top". Then it defines a "Sub
Menu" in the "top" menu with an id of "sub". Then it defines a "Sub Sub
Menu" in the "sub" menu with an id of "subsub".

Just like a directory structure, you have to define a path of IDs
terminating with a group/separator name. i.e. if I wanted to add an
action to the Sub Sub Menu, my menubarPath would be
"top/sub/subsub/additions"

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: path in editor menus [message #336109 is a reply to message #336101] Thu, 21 May 2009 14:55 Go to previous messageGo to next message
Williams Mising name is currently offline Williams Mising nameFriend
Messages: 43
Registered: July 2009
Member
Paul,
Thanks for the reply. I still want to make sure that I get the idea.

> Paul Webster wrote:
>>
>> <menu id="top" label="Top Menu" path="additions">
>> <separator name="additions"/>
>> </menu>

What happen if path="A.B.C/additions"? in the above top menu. Is A.B.C
a menu id, right? Where can I find it? Or A.B.C is the directory where you
can find menu whose id is top?

>> <menu id="sub" label="Sub Menu" path="top/additions">
>> <separator name="additions"/>
>> </menu>

Is top a menu id or the path where you find the menu whose id is top?
Thanks.
Will

>> <menu id="subsub" label="Sub Sub Menu" path="top/sub/additions">
>> <separator name="additions"/>
>> </menu>
>>
>> This creates the cascading menu: Top Menu>Sub Menu>Sub Sub Menu

> First it defines "Top Menu" with an id of "top". Then it defines a "Sub
> Menu" in the "top" menu with an id of "sub". Then it defines a "Sub Sub
> Menu" in the "sub" menu with an id of "subsub".

> Just like a directory structure, you have to define a path of IDs
> terminating with a group/separator name. i.e. if I wanted to add an
> action to the Sub Sub Menu, my menubarPath would be
> "top/sub/subsub/additions"

> PW
Re: path in editor menus [message #336111 is a reply to message #336109] Thu, 21 May 2009 17:59 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Williams wrote:
> Paul,
> Thanks for the reply. I still want to make sure that I get the idea.
>
>> Paul Webster wrote:
>>>
>>> <menu id="top" label="Top Menu" path="additions">
>>> <separator name="additions"/>
>>> </menu>
>
> What happen if path="A.B.C/additions"?

This only works if you've already defined a <menu/> whose id="A.B.C".
path="additions" is the GroupMarker in the main menu bar, between the
Project and Window menus.

>>> <menu id="sub" label="Sub Menu" path="top/additions">
>>> <separator name="additions"/>
>>> </menu>
>
> Is top a menu id or the path where you find the menu whose id is top?
> Thanks.

top is the id of the menu I created in my first menu element.

Later,
PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: path in editor menus [message #336112 is a reply to message #336111] Thu, 21 May 2009 19:38 Go to previous messageGo to next message
Williams Mising name is currently offline Williams Mising nameFriend
Messages: 43
Registered: July 2009
Member
Paul Webster wrote:

> Williams wrote:
>> Paul,
>> Thanks for the reply. I still want to make sure that I get the idea.
>>
>>> Paul Webster wrote:
>>>>
>>>> <menu id="top" label="Top Menu" path="additions">
>>>> <separator name="additions"/>
>>>> </menu>
>>
>> What happen if path="A.B.C/additions"?

> This only works if you've already defined a <menu/> whose id="A.B.C".
> path="additions" is the GroupMarker in the main menu bar, between the
> Project and Window menus.

I came to this question from the EMF General Validation Example.
After I search org.eclipse.emf.examples.extlibraryMenuID based on the
following declaration in the plugin.xml file:

path="org.eclipse.emf.examples.extlibraryMenuID/additions"

I cannot find another place to define a menu whose id is
"org.eclipse.emf.examples.extlibraryMenuID". However, I find the following
statement:

208: IMenuManager submenuManager = new
MenuManager(EXTLibraryEditorPlugin.INSTANCE.getString("_UI_EXTLibraryEditor_menu "),
"org.eclipse.emf.examples.extlibraryMenuID"); //$NON-NLS-1$ //$NON-NLS-2$

in one of the java files. Does the above statement define that menu id? To
verify this, I only replace org.eclipse.emf.examples.extlibraryMenuID with
A in the plugin.xml file. The EMF Validation Example still works without
changing the above Java Statement? I get confused here...


>>>> <menu id="sub" label="Sub Menu" path="top/additions">
>>>> <separator name="additions"/>
>>>> </menu>
>>
>> Is top a menu id or the path where you find the menu whose id is top?
>> Thanks.

> top is the id of the menu I created in my first menu element.


I fully understand this now.
will
Re: path in editor menus [message #336118 is a reply to message #336112] Fri, 22 May 2009 12:21 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Williams wrote:

> path="org.eclipse.emf.examples.extlibraryMenuID/additions"
> I cannot find another place to define a menu whose id is
> "org.eclipse.emf.examples.extlibraryMenuID". However, I find the
> following statement:
>
> 208: IMenuManager submenuManager = new
> MenuManager(EXTLibraryEditorPlugin.INSTANCE.getString("_UI_EXTLibraryEditor_menu "),
> "org.eclipse.emf.examples.extlibraryMenuID"); //$NON-NLS-1$ //$NON-NLS-2$
> in one of the java files. Does the above statement define that menu id?
> To verify this, I only replace org.eclipse.emf.examples.extlibraryMenuID
> with A in the plugin.xml file. The EMF Validation Example still works
> without changing the above Java Statement? I get confused here...

I don't know why it still works. But yes, this is programmatically
defining a menu with an ID of org.eclipse.emf.examples.extlibraryMenuID.
Check out
org.eclipse.ui.internal.ide.WorkbenchActionBuilder.createFil eMenu() It
creates a MenuManager with id=file.

This can then be used as menubarPath="file/additions" in plugin.xml

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:Re: Making View Visible After Mouse Click
Next Topic:Moving resources between projects
Goto Forum:
  


Current Time: Thu Dec 18 14:25:25 GMT 2014

Powered by FUDForum. Page generated in 0.03862 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software