private void hookContextMenu() { MenuManager menuMgr = new MenuManager("#PopupMenu"); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener( new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { ResultModelTreeView.this.fillContextMenu(manager); } }); Menu menu = menuMgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, viewer); }
@Override public void setFocus() { viewer.getControl().setFocus(); }