|Re: Drop down menu below main menu programmatically [message #673702 is a reply to message #673636]
||Tue, 24 May 2011 13:58
| Paul Webster
Registered: July 2009
Dirk Hoffmann wrote on Tue, 24 May 2011 05:49|
MyContributionItem.fill(Menu,int) would then add MenuItems to the passed
The system is just not that dynamic, especially the main menu bar. There are hacks in 3.x that would probably allow it to work ... until 4.x, where they would fail.
Unfortunately this doesn't go far enough. I also want the label of the
menu to be specified programmatically. I also want the drop down menu
and its content to be changed upon some other events, e.g. stopping or
starting the plug-in, changing preferences.
If you are literally creating SWT MenuItems yourself, you are responsible for the entire subsystem that manages events and keeps them up to date. The reason you wouldn't be able to find a howto is because it's hard and no one wants to do it
If you use a CompoundContributionItem, you get a chance to fill in the menu on every show ... your user can't update preferences while your other menu is open, and so updating the menu item's label and state on the next show would be adequate, no?
Also, you can fill in your menu with CommandContributionItems. If your handler updates its enabled state correctly, the menu items would go enabled/disabled while the menu was open. Also, handlers that are IElementUpdaters can update text of the menu items based on some external event through the ICommandService API.
Powered by FUDForum
. Page generated in 0.01584 seconds