Java swt treeview popup menu
Posted
by InsertNickHere
on Stack Overflow
See other posts from Stack Overflow
or by InsertNickHere
Published on 2010-06-09T12:43:15Z
Indexed on
2010/06/09
13:32 UTC
Read the original article
Hit count: 310
Hiho,
currently I have a working popup menu which appears when I click on a treeview item. But I want to show different popups for different tree view entries. I don't get a idea how to do so...
Here is my code for creating the menu:
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
Action action = new Action() {
public void run() {
// So something
}
};
action.setText("Set as working file");
manager.add(action);
}
});
Menu menu = menuMgr.createContextMenu(getTree());
getTree().setMenu(menu);
© Stack Overflow or respective owner