Reputation: 2040
I have a MenuManager that is filled with Actions, is it possible to access the corresponding MenuItem for the action (ContributionItem) ?
MenuManager menuManager = new MenuManager("#PopupMenu", "contextMenu");
menuManager.add(IAction1...);
menuManager.add(IAction2...);
Menu menu = menuManager.createContextMenu(myTreeVvewer.getControl());
myTreeVvewer.getControl().setMenu(menu);
myTreeVvewer.getTree().addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
//Iterate menu items of menu and set something...
}
}
Upvotes: 0
Views: 963
Reputation: 2271
It would probably be easier to use the option MenuManager#.setRemoveAllWhenShown(true);
and then dynamically add the menu items in a IMenuListener
.
Upvotes: 3