Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Adding a file menu item via an extension point
Adding a file menu item via an extension point [message #526348] Fri, 09 April 2010 18:02 Go to next message
Greg Babcock is currently offline Greg BabcockFriend
Messages: 53
Registered: July 2009
Member
I am trying to add menu item to the file menu via an extension point. I
have done some experimenting and a lot of googleing but have not been able
to get it to work. Is it possible to contribute via an extension point to a
menu that was created via code? If so can someone provide an example or
point to the appropriate documentation.

Thanks

GB
Re: Adding a file menu item via an extension point [message #526356 is a reply to message #526348] Fri, 09 April 2010 19:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rjl.third-monday.com

In your actionSets extension point, specify the correct 'menubarPath'
string:

<extension
point="org.eclipse.ui.actionSets">
<actionSet
id="com.<MY>.objects"
label="MyObjects"
>
<action
class="com.<MY>.Action"
menubarPath="File/additions"
/>
</actionSet>
</extension>

I'm not sure on the exact path, I can only guess that it's 'File'.

On 04/09/2010 01:02 PM, Greg Babcock wrote:
> I am trying to add menu item to the file menu via an extension point. I
> have done some experimenting and a lot of googleing but have not been able
> to get it to work. Is it possible to contribute via an extension point to a
> menu that was created via code? If so can someone provide an example or
> point to the appropriate documentation.
>
> Thanks
>
> GB
>
>
Re: Adding a file menu item via an extension point [message #526369 is a reply to message #526356] Fri, 09 April 2010 21:08 Go to previous messageGo to next message
Greg Babcock is currently offline Greg BabcockFriend
Messages: 53
Registered: July 2009
Member
Thanks Russ,

I should have been more specific, I am looking for a way to set the menu
via the command infrastructure using the org.eclipse.ui.menus extention
point?

Thanks,

GB

I should have been more specific.
"Russ Loucks" <rjl@third-monday.com> wrote in message
news:hpnu5v$h30$2@build.eclipse.org...
> In your actionSets extension point, specify the correct 'menubarPath'
> string:
>
> <extension
> point="org.eclipse.ui.actionSets">
> <actionSet
> id="com.<MY>.objects"
> label="MyObjects"
> >
> <action
> class="com.<MY>.Action"
> menubarPath="File/additions"
> />
> </actionSet>
> </extension>
>
> I'm not sure on the exact path, I can only guess that it's 'File'.
>
> On 04/09/2010 01:02 PM, Greg Babcock wrote:
>> I am trying to add menu item to the file menu via an extension point. I
>> have done some experimenting and a lot of googleing but have not been
>> able
>> to get it to work. Is it possible to contribute via an extension point
>> to a
>> menu that was created via code? If so can someone provide an example or
>> point to the appropriate documentation.
>>
>> Thanks
>>
>> GB
>>
>>
>
Re: Adding a file menu item via an extension point [message #526405 is a reply to message #526369] Sat, 10 April 2010 14:08 Go to previous messageGo to next message
Greg Babcock is currently offline Greg BabcockFriend
Messages: 53
Registered: July 2009
Member
I found IWorkbenchCommandConstants, and am not creating all menus and via
the menu extention point. This gives my RCP app a the clean menu
implementation I was looking for.

GB
"Greg Babcock" <greg.babcock@testadvantage.com> wrote in message
news:hpo4vo$2bb$1@build.eclipse.org...
> Thanks Russ,
>
> I should have been more specific, I am looking for a way to set the menu
> via the command infrastructure using the org.eclipse.ui.menus extention
> point?
>
> Thanks,
>
> GB
>
> I should have been more specific.
> "Russ Loucks" <rjl@third-monday.com> wrote in message
> news:hpnu5v$h30$2@build.eclipse.org...
>> In your actionSets extension point, specify the correct 'menubarPath'
>> string:
>>
>> <extension
>> point="org.eclipse.ui.actionSets">
>> <actionSet
>> id="com.<MY>.objects"
>> label="MyObjects"
>> >
>> <action
>> class="com.<MY>.Action"
>> menubarPath="File/additions"
>> />
>> </actionSet>
>> </extension>
>>
>> I'm not sure on the exact path, I can only guess that it's 'File'.
>>
>> On 04/09/2010 01:02 PM, Greg Babcock wrote:
>>> I am trying to add menu item to the file menu via an extension point. I
>>> have done some experimenting and a lot of googleing but have not been
>>> able
>>> to get it to work. Is it possible to contribute via an extension point
>>> to a
>>> menu that was created via code? If so can someone provide an example or
>>> point to the appropriate documentation.
>>>
>>> Thanks
>>>
>>> GB
>>>
>>>
>>
>
>
Re: Adding a file menu item via an extension point [message #526627 is a reply to message #526348] Mon, 12 April 2010 13:09 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Greg Babcock wrote:
> I am trying to add menu item to the file menu via an extension point. I
> have done some experimenting and a lot of googleing but have not been able
> to get it to work. Is it possible to contribute via an extension point to a
> menu that was created via code? If so can someone provide an example or
> point to the appropriate documentation.

If you are creating some of your main menus in your ActionBarAdvisor,
you can still use org.eclipse.ui.menus to add commands to them using
their ID. ex: in the IDE, WorkbenchActionBuilder creates the main menu
skeleton.

I can add to it using locationURI="menu:file?after=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/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Adding a file menu item via an extension point [message #526670 is a reply to message #526627] Mon, 12 April 2010 14:38 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 12.04.2010 15:09, Paul Webster wrote:
> Greg Babcock wrote:
>> I am trying to add menu item to the file menu via an extension point.
>> I have done some experimenting and a lot of googleing but have not
>> been able to get it to work. Is it possible to contribute via an
>> extension point to a menu that was created via code? If so can someone
>> provide an example or point to the appropriate documentation.
>
> If you are creating some of your main menus in your ActionBarAdvisor,
> you can still use org.eclipse.ui.menus to add commands to them using
> their ID. ex: in the IDE, WorkbenchActionBuilder creates the main menu
> skeleton.
>
> I can add to it using locationURI="menu:file?after=additions"

I agree that this works, but it looks like an unfortunate constraint.
In fact, I can create my complete menu structure without any code
within the ActionBarAdvisor, except until I need to provide at least
a single action via code. E.g. ActionFactory.RESET_PERSPECTIVE has
no command pendant and I cannot use a wrapping command for this
functionality. Therefore I must provide it via the ActionBarAdvisor,
in which I *also* need to define a new menu manager given some ID,
e.g. IWorkbenchActionConstants.M_WINDOW. Unfortunately it seems as
if I cannot refer to a manager for some identifiable menu contribution
already defined via plugin.xml - or did I miss something?

Greetings from Bremen,

Daniel Krügler
Re: Adding a file menu item via an extension point [message #526730 is a reply to message #526670] Mon, 12 April 2010 18:19 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Daniel Krügler wrote:
> Unfortunately it seems as
> if I cannot refer to a manager for some identifiable menu contribution
> already defined via plugin.xml - or did I miss something?

correct. The "order of operations" is ActionBarAdvisor creates a
structure, menuContributions are applied, and then legacy action
contributions (actionSets, etc). So you can only see things contributed
by the operations that are run before your contributions.

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/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:[solved] Common Navigator Drag and Drop
Next Topic:How to determine the java vendor during runtime
Goto Forum:
  


Current Time: Sat Apr 27 03:25:54 GMT 2024

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

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

Back to the top