Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to add menus programmatically?
How to add menus programmatically? [message #435648] Sat, 20 August 2005 16:47 Go to next message
Eclipse UserFriend
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 17:10 Go to previous messageGo to next message
Eclipse UserFriend
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 04:57 Go to previous messageGo to next message
Eclipse UserFriend
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 04:38 Go to previous messageGo to next message
Eclipse UserFriend
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 09:37 Go to previous message
Eclipse UserFriend
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: Sat Aug 30 19:33:08 EDT 2025

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

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

Back to the top