Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Dynamic submenus
Dynamic submenus [message #309739] Mon, 06 November 2006 23:56 Go to next message
Eclipse UserFriend
How can I create a cascading submenu off an existing eclipse menu where I
create the menuitems dynamically?

In principle this seems like it should be easy. Eclipse has cascading
menus and using the IObjectActionDelegate called in a
org.eclipse.ui.popupMenus extension point I can get control when my menu
item is selected. Unfortunately there does not seem to be a way to get a
pointer to the menu from inside the IObjectActionDelegate. All the docs
and online hints I have been able to find are for static menu entries.

Hints?

Thanks,
John.
Re: Dynamic submenus [message #309747 is a reply to message #309739] Tue, 07 November 2006 07:23 Go to previous message
Eclipse UserFriend
John J Barton wrote:
> How can I create a cascading submenu off an existing eclipse menu where
> I create the menuitems dynamically?
>
> In principle this seems like it should be easy. Eclipse has cascading
> menus and using the IObjectActionDelegate called in a
> org.eclipse.ui.popupMenus extension point I can get control when my menu
> item is selected. Unfortunately there does not seem to be a way to get
> a pointer to the menu from inside the IObjectActionDelegate. All the
> docs and online hints I have been able to find are for static menu entries.

It looks like xml contributions for dynamic menus are limited to
org.eclipse.ui.actionSets, toolbar pulldowns that implement
IWorkbenchWindowPulldownDelegate.

The other way is probably the static way you are referring to:

MenuManager m = new MenuManager("MenuItem");
m.removeAllWhenShown(true);
m.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
fillSearchActions(manager);
}
});

getViewSite().getActionBars().getMenuManager().add(m);

Later,
PW
Previous Topic:New Context menus not appearing in Common Navigator
Next Topic:How to filter /bin directory from Synchronize view?
Goto Forum:
  


Current Time: Sun Nov 09 17:19:37 EST 2025

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

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

Back to the top