Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to contribute a new command into a sub-context menu?
How to contribute a new command into a sub-context menu? [message #492900] Thu, 22 October 2009 05:56 Go to next message
Eclipse User
Originally posted by: formatzeh.gmx.de

I have two plugins. In the first I declared a command with a parameter
and some menu contributions for that command in the context menu of a
generated EMF editor. The schema looks like this:

<extension point="org.eclipse.ui.commands">
<command
defaultHandler="my.TransformationHandler"
id="my.command.transform"
name="CRUISeTransform">
<commandParameter
id="my.command.transform.param"
name="Transformation File"
optional="false"
typeId="my.converter.id.URI">
</commandParameter>
</command>
<commandParameterType
converter="my.URIConverter"
id="my.converter.id.URI"
type="org.eclipse.emf.common.util.URI">
</commandParameterType>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:my.generated.MetaModelEditorID?before=additions ">
<menu
label="My Transformations">
<command
commandId="my.command.transform"
label="Generate Something"
style="push">
<parameter
name="my.command.transform.param"
value="theValue">
</parameter>
</command>
</menu>
</menuContribution>
</extension>

And the second plugin: Here I want to add a new entry in the sub-context
menu which was contributed in the first plugin. But the problem I see is
the following. When adding a new menuContribution to
org.eclipse.ui.menus I only can specify the locationURI of the parent
context menu, isn't it? That means in this case I only can a new
contribution to "popup:my.generated.MetaModelEditorID" but not to the
first created sub-context menu named "My Transformations". Am I
understandable and can you help me?
Re: How to contribute a new command into a sub-context menu? [message #492904 is a reply to message #492900] Thu, 22 October 2009 06:20 Go to previous messageGo to next message
Eclipse User
Originally posted by: formatzeh.gmx.de

I found out something:

> <menu
> label="My Transformations">
If I add an id here it can be used to specify a contribution path as the
tooltip told me ;)

So I added id="transformationsMenu" to the sub-context menu. But I'm
still not successful with the following locationURI in the second plugin:

locationURI=" popup:popup:my.generated.MetaModelEditorID/transformationsMe nu "

Can you please help me?
Re: How to contribute a new command into a sub-context menu? [message #493103 is a reply to message #492900] Fri, 23 October 2009 03:26 Go to previous messageGo to next message
Eclipse User
Originally posted by: formatzeh.gmx.de

no ideas?
Re: How to contribute a new command into a sub-context menu? [message #493144 is a reply to message #493103] Fri, 23 October 2009 07:43 Go to previous messageGo to next message
Christian is currently offline Christian
Messages: 72
Registered: July 2009
Member
Gilbert Mirenque schrieb:
> no ideas?

have you tried putting a invisible speparator into the submenu...
giving the seperator an id and then use that id in the uri..

i.e. menu has ida A
submenu contains sperator with id B
then
uri: popup:A?after=B
Re: How to contribute a new command into a sub-context menu? [message #493161 is a reply to message #493144] Fri, 23 October 2009 08:42 Go to previous messageGo to next message
Eclipse User
Originally posted by: formatzeh.gmx.de

Thanks for the idea Christian, but unfortunately it doesn't work :(

> have you tried putting a invisible speparator into the submenu...
> giving the seperator an id and then use that id in the uri..
>
> i.e. menu has ida A
> submenu contains sperator with id B
> then
> uri: popup:A?after=B
>
Re: How to contribute a new command into a sub-context menu? [message #493651 is a reply to message #492904] Tue, 27 October 2009 09:32 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Eclipse User wrote on Thu, 22 October 2009 06:20
Originally posted by: formatzeh.gmx.de

I found out something:

> <menu
> label="My Transformations">
If I add an id here it can be used to specify a contribution path as the
tooltip told me Wink

So I added id="transformationsMenu" to the sub-context menu. But I'm
still not successful with the following locationURI in the second plugin:

locationURI=" popup:popup:my.generated.MetaModelEditorID/transformationsMe nu "

Can you please help me?


It would be popup:transformationsMenu ... locationURIs specify IDs not paths.

You could add an additions separator (visible="false) when you create the menu in the first contribution and then your second locationURI is popup:transformationsMenu?after=additions

PW


Re: How to contribute a new command into a sub-context menu? [message #493836 is a reply to message #493651] Wed, 28 October 2009 04:46 Go to previous message
Eclipse User
Originally posted by: formatzeh.gmx.de

Thank you very much Paul. That works :) Thought to specify path's
instead of id's.
Previous Topic:Adding image to initial page Composite on opening of applictaion
Next Topic:addFocusTracker for a Composite.
Goto Forum:
  


Current Time: Mon Jul 28 10:34:19 EDT 2014

Powered by FUDForum. Page generated in 0.03549 seconds