Paul Webster Messages: 6859 Registered: July 2009 Location: Ottawa
On 06/03/2013 05:14 PM, Mike Johnson wrote:
> I've created several context menu items/buttons from the Popup Menu PDE
> template so they're generated from plugin.xml and contain code in their
> respective classes. Though this works, I need to be able to modify the
> context menu from within code dynamically based on a highlighted selection.
You can try contributing different menu items based on the current
selection. This works with
org.eclipse.ui.menus/menuContributions/commands that include a
visibleWhen or with org.eclipse.ui.popupMenus/objectContributions.
Another option is to contribute a dynamic element through
org.eclipse.ui.menus, implement it subclassing CompoundContributionItem,
and then you can provide the specific items you want on every menu