Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Dynamic menu
Dynamic menu [message #467118] Sat, 28 April 2007 01:48 Go to next message
Eclipse UserFriend
In my RCP app , i want to add/remove menus .

Now i've found that in the workbenchwindowadvisor class ,we can get the
menumanager this way:
this.getWindowConfigurer().getActionBarConfigurer().getMenuM anager();

But ,my question is :how to get the workbenchwindowadvisor object?

or ,maybe,there is better ways to get the Menumanager()?

or,there is other ways to add menus when the app is running?
Re: Dynamic menu [message #467128 is a reply to message #467118] Sat, 28 April 2007 04:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zxkane.msn.com

define your actions in plugin.xml and set the actionSet invisible

you can show the actionSet by calling showActionSet in runtime

> In my RCP app , i want to add/remove menus .
>
> Now i've found that in the workbenchwindowadvisor
> class ,we can get the
> menumanager this way:
> this.getWindowConfigurer().getActionBarConfigurer().ge
> tMenuManager();
>
> But ,my question is :how to get the
> workbenchwindowadvisor object?
>
> or ,maybe,there is better ways to get the
> Menumanager()?
>
> or,there is other ways to add menus when the app is
> running?
>
>
Re: Dynamic menu [message #467157 is a reply to message #467128] Sun, 29 April 2007 22:00 Go to previous messageGo to next message
Eclipse UserFriend
I know this, but I need another way.
The reason is :
the menu i want add may be dynamic ,for example ,the text displayed on the
menu is dynamic,it is not the same at different time.


"kane" <zxkane@msn.com>
??????:12919341.1177749689525.JavaMail.root@cp1.javalobby.org...
> define your actions in plugin.xml and set the actionSet invisible
>
> you can show the actionSet by calling showActionSet in runtime
>
> &gt; In my RCP app , i want to add/remove menus .
> &gt;
> &gt; Now i've found that in the workbenchwindowadvisor
> &gt; class ,we can get the
> &gt; menumanager this way:
> &gt; this.getWindowConfigurer().getActionBarConfigurer().ge
> &gt; tMenuManager();
> &gt;
> &gt; But ,my question is :how to get the
> &gt; workbenchwindowadvisor object?
> &gt;
> &gt; or ,maybe,there is better ways to get the
> &gt; Menumanager()?
> &gt;
> &gt; or,there is other ways to add menus when the app is
> &gt; running?
> &gt;
> &gt;
Re: Dynamic menu [message #467160 is a reply to message #467157] Mon, 30 April 2007 01:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zxkane.msn.com

define retargetable actions, and set 'allowLabelUpdate' as true
Re: Dynamic menu [message #467162 is a reply to message #467160] Mon, 30 April 2007 02:04 Go to previous messageGo to next message
Eclipse UserFriend
Yes ,that can do it .
But,that is not what i want. Or that is not what my boss want. :)

what i want is add dynamic menu , using code . not in the plugin.xml.

can that be done?
"kane" <zxkane@msn.com>
??????:31450660.1177911189790.JavaMail.root@cp1.javalobby.org...
> define retargetable actions, and set 'allowLabelUpdate' as true
Re: Dynamic menu [message #467231 is a reply to message #467162] Tue, 01 May 2007 15:43 Go to previous messageGo to next message
Eclipse UserFriend
There's no API way to do what you want.

you can add to editor action bars and view action bars through the
IViewSite and IEditorSite respectivately.

But the main menu and main toolbar area only available in the
application action bar advisor, or by hacking internals.

What eclipse *does* like:

1) use ActionSets and update the labels in your selectionChanged or run
methods (they don't have to be retargetable)

2) in your application action bar adviser are a CompoundContributionItem
where you need the dynamic entries ... you might have to carefully
tune this.

PW
Re: Dynamic menu [message #467244 is a reply to message #467231] Tue, 01 May 2007 22:12 Go to previous messageGo to next message
Eclipse UserFriend
Thanks.
I use a static filed .
In the fillMenuBar()menthod , i write this:

Tools.menuBar = menubar;

Then ,I can use this Tools.menuBar to add new menu,but is it a good way?

Another way is to use the Shell'menthod : Menu getMenuBar().But after i'got
the Menu obj, i haven't add a new Menu into it successfully.

Anyone else kowns about it?

"Paul Webster" <pwebster@ca.ibm.com>
??????:f185dg$jlh$1@build.eclipse.org...
> There's no API way to do what you want.
>
> you can add to editor action bars and view action bars through the
> IViewSite and IEditorSite respectivately.
>
> But the main menu and main toolbar area only available in the application
> action bar advisor, or by hacking internals.
>
> What eclipse *does* like:
>
> 1) use ActionSets and update the labels in your selectionChanged or run
> methods (they don't have to be retargetable)
>
> 2) in your application action bar adviser are a CompoundContributionItem
> where you need the dynamic entries ... you might have to carefully tune
> this.
>
> PW
Re: Dynamic menu [message #467713 is a reply to message #467244] Thu, 10 May 2007 08:51 Go to previous message
Eclipse UserFriend
Dollyn wrote:
> Thanks.
> I use a static filed .
> In the fillMenuBar()menthod , i write this:
>
> Tools.menuBar = menubar;
>
> Then ,I can use this Tools.menuBar to add new menu,but is it a good way?

Well, it might be OK for an RCP app, assuming eclipse doesn't do
anything like wipe it and rebuild it.


> Another way is to use the Shell'menthod : Menu getMenuBar().But after i'got
> the Menu obj, i haven't add a new Menu into it successfully.

This won't work. The menu manager will dispose any Menu or MenuItems it
cannot find a matching contribution item for.

Later,
PW
Previous Topic:ISaveablePart2 and Perspective
Next Topic:How can I specify a position for a view ?
Goto Forum:
  


Current Time: Thu May 22 22:57:03 EDT 2025

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

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

Back to the top