[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: creating submenus to ObjectContribution popupMenu on runtime

Neelesh Thakur wrote:
Hi,

My plugin has popup menu on IMethod based on objectContribution action. I want to add submenu to this menu item. For each method submenu; it may have different items. So it has to figured out at run time.

You can use org.eclipse.ui.popupMenus to add an objectContribution submenu as well as the action. But there's no way to make the actions in the submenu dynamic, except within the scope of the objectContribution declarative conditions, like <selection/>. i.e. declare all of your action and let the selection element remove the ones that don't apply.


What kind of actions are they that you want them to be dynamic? Do you have something like 8 actions which may or may not show up? Or is it just that you want to change labels?

In 3.3 you can use org.eclipse.ui.menus and menu contributions to place a <dynamic/> element in any submenu. That points to a CompoundContribution, which will expand to multiple ContributionItems.

Later,
PW