Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to add menus programmatically?
How to add menus programmatically? [message #435648] Sat, 20 August 2005 20:47 Go to next message
user is currently offline userFriend
Messages: 296
Registered: July 2009
Senior Member
How can I add menus programmatically in my plugin?
Re: How to add menus programmatically? [message #435649 is a reply to message #435648] Sat, 20 August 2005 21:10 Go to previous messageGo to next message
Marc Heimann is currently offline Marc HeimannFriend
Messages: 18
Registered: July 2009
Junior Member
In your WorkbenchAdvisor get the MenuManager in fillActionBars and use
the add-method to put them in the menu.

Cheers
Marc

user@domain.invalid wrote:
> How can I add menus programmatically in my plugin?
Re: How to add menus programmatically? [message #435654 is a reply to message #435649] Sun, 21 August 2005 08:57 Go to previous messageGo to next message
user is currently offline userFriend
Messages: 296
Registered: July 2009
Senior Member
As far as I understand, this method is applicable with RCP application,
but what should I do if I have only a plugin class? How should I call
WorkbenchAdvisor? Or how could I get reference to MenuManager of the
main menu within plugin class?

Andrey.

Marc Heimann пишет:
> In your WorkbenchAdvisor get the MenuManager in fillActionBars and use
> the add-method to put them in the menu.
>
> Cheers
> Marc
>
> user@domain.invalid wrote:
>
>> How can I add menus programmatically in my plugin?
Re: How to add menus programmatically? [message #435661 is a reply to message #435654] Mon, 22 August 2005 08:38 Go to previous messageGo to next message
Marcus Olk is currently offline Marcus OlkFriend
Messages: 130
Registered: July 2009
Senior Member
user@domain.invalid wrote:
> As far as I understand, this method is applicable with RCP application,
> but what should I do if I have only a plugin class? How should I call
> WorkbenchAdvisor? Or how could I get reference to MenuManager of the
> main menu within plugin class?

AFAIK the RCP framework extensions of the workbench classes are the
only objects capable of contributing to the workbench menu and toolbar
programmatically. If you need to contribute from within a plugin
you'll have to extend the corresponding extension points in your
plugin manifest (plugin.xml).

We're currently struggling with this basically very flexible concept
because we have no control which contribution that has been described
using the static way via the manifest (XML) shall be active at
runtime (dynamically) implementing a kind of role based contribution
filter ("user X in role Y shall see contribution A but not B").

If you don't need to filter the contributions extending the
corresponding extension points is the way to go.

In your workbench ActionBarAdvisor implementation you should set up
your basic menu and toolbar structure (File, Edit, Window Help etc.)
programmatically. All remaining contributions can be described very
conveniently using XML (plugin.xml).

Hope that helps,
Marcus
Re: How to add menus programmatically? [message #435714 is a reply to message #435661] Mon, 22 August 2005 13:37 Go to previous message
user is currently offline userFriend
Messages: 296
Registered: July 2009
Senior Member
Thank you for the answer, but the real problem is that I need a some
dynamic menu items contributed through plugins.

May be the solution could be in creation of new extension point for that
purpose.

Andrey.

Marcus Olk пишет:
> user@domain.invalid wrote:
>
>> As far as I understand, this method is applicable with RCP
>> application, but what should I do if I have only a plugin class? How
>> should I call WorkbenchAdvisor? Or how could I get reference to
>> MenuManager of the main menu within plugin class?
>
>
> AFAIK the RCP framework extensions of the workbench classes are the
> only objects capable of contributing to the workbench menu and toolbar
> programmatically. If you need to contribute from within a plugin
> you'll have to extend the corresponding extension points in your
> plugin manifest (plugin.xml).
>
> We're currently struggling with this basically very flexible concept
> because we have no control which contribution that has been described
> using the static way via the manifest (XML) shall be active at
> runtime (dynamically) implementing a kind of role based contribution
> filter ("user X in role Y shall see contribution A but not B").
>
> If you don't need to filter the contributions extending the
> corresponding extension points is the way to go.
>
> In your workbench ActionBarAdvisor implementation you should set up
> your basic menu and toolbar structure (File, Edit, Window Help etc.)
> programmatically. All remaining contributions can be described very
> conveniently using XML (plugin.xml).
>
> Hope that helps,
> Marcus
Previous Topic:Modality of detached views
Next Topic:extends org.eclipse.search
Goto Forum:
  


Current Time: Thu Dec 26 23:09:26 GMT 2024

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

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

Back to the top