@Override protected void contributeActions() { final SourceFilesCheckinControl sourceFilesSubControl = getCheckinControl().getSourceFilesSubControl(); sourceFilesSubControl.getContextMenu().addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { final String groupId = StandardActionConstants.HOSTING_CONTROL_CONTRIBUTIONS; manager.appendToGroup(groupId, viewSubMenu); manager.appendToGroup(groupId, new Separator()); manager.appendToGroup(groupId, compareSubMenu); } }); (sourceFilesSubControl).getChangesTable().addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent event) { if (viewAction.isEnabled()) { viewAction.run(); } } }); }
@Override protected void contributeActions() { final SourceFilesCheckinControl sourceFilesSubControl = getCheckinControl().getSourceFilesSubControl(); sourceFilesSubControl.getContextMenu().addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { final String groupId = StandardActionConstants.HOSTING_CONTROL_CONTRIBUTIONS; manager.appendToGroup(groupId, viewSubMenu); manager.appendToGroup(groupId, new Separator()); manager.appendToGroup(groupId, compareSubMenu); } }); (sourceFilesSubControl).getChangesTable().addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent event) { if (viewAction.isEnabled()) { viewAction.run(); } else if (viewUnmodifiedAction.isEnabled()) { viewUnmodifiedAction.run(); } } }); }
private void contributeActions() { contextMenu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { manager.add(new Separator(StandardActionConstants.HOSTING_CONTROL_CONTRIBUTIONS)); manager.add(new Separator(StandardActionConstants.PRIVATE_CONTRIBUTIONS)); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, newNodeAction); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, renameNodeAction); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, deleteNodeAction); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, new Separator()); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, moveUpNodeAction); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, moveDownNodeAction); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, new Separator()); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, demoteNodeAction); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, promoteNodeAction); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, new Separator()); manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, refreshAction); } }); }
private Composite createPendingChangesTable(final Composite parent) { int style = SWT.FULL_SELECTION | SWT.MULTI; if (options.isSourceFilesCheckboxes()) { style |= SWT.CHECK; } changesTable = new ChangesTable(parent, style); AutomationIDHelper.setWidgetID(changesTable, SOURCEFILES_TABLE_ID); changesTable.getContextMenu().addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillMenu(manager); } }); setSelectionProvider(changesTable); setContextMenu(changesTable.getContextMenu()); return changesTable; }
/** * Creates the context menu. */ private void createContextMenu() { // create menu manager MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager mgr) { fillContextMenu(mgr); } }); // create the menu Menu menu = menuMgr.createContextMenu(getTreeViewer().getControl()); getTreeViewer().getControl().setMenu(menu); //register menu for extensions //getSite().registerContextMenu(menuMgr, getTreeViewer()); }
public void setupMenuListener(MenuManager menuMgr) { menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { ISelection selection = viewer.getSelection(); Object obj = ((IStructuredSelection) selection).getFirstElement(); if (obj instanceof DisplayObject) { IElement element = ((DisplayObject) obj).getElement(); if (element != null) { Set<BaseTraceability> path = element.getTraceability(); if (path != null) { MenuUtils.setTraceToCodeMenu(manager, path, log); } } } else { System.out.println(obj.getClass().getSimpleName()); } } }); }
private void createPopupMenu() { removeHistoryItemAction = new RemoveHistoryItemAction(); removeHistoryActionContributionItem = new ActionContributionItem( removeHistoryItemAction); contextMenuManager = new MenuManager(); contextMenuManager.setRemoveAllWhenShown(true); contextMenuManager.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { fillContextMenu(manager); } }); final Table table = list.getTable(); Menu menu= contextMenuManager.createContextMenu(table); table.setMenu(menu); }
/** * Contextual menu */ private void createContextMenu() { // Create menu manager. MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager mgr) { fillContextMenu(mgr); } }); // Create menu. Menu menu = menuMgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); // Register menu for extension. getSite().registerContextMenu(menuMgr, viewer); }
private void addRefactorSubmenu(IMenuManager menu) { MenuManager refactorSubmenu = new MenuManager(RefactoringMessages.RefactorMenu_label, MENU_ID); // refactorSubmenu.setActionDefinitionId(QUICK_MENU_ID); if (fEditor != null) { // final ITypeRoot element= getEditorInput(); // if (element != null && ActionUtil.isOnBuildPath(element)) { refactorSubmenu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { refactorMenuShown(manager); } }); refactorSubmenu.add(fNoActionAvailable); menu.appendToGroup(fGroupName, refactorSubmenu); // } } else { ISelection selection = fSelectionProvider.getSelection(); for (Iterator<SelectionDispatchAction> iter = fActions.iterator(); iter.hasNext();) { iter.next().update(selection); } if (fillRefactorMenu(refactorSubmenu) > 0) menu.appendToGroup(fGroupName, refactorSubmenu); } }
/** * Creates a pop-up menu on the given control * * @param menuControl * the control with which the pop-up menu will be associated */ private void createContextMenu(Viewer viewer) { Control menuControl = viewer.getControl(); MenuManager menuMgr = new MenuManager("#PopUp"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager mgr) { fillContextMenu(mgr); } }); Menu menu = menuMgr.createContextMenu(menuControl); menuControl.setMenu(menu); // register the context menu such that other plugins may contribute to // it getSite().registerContextMenu(menuMgr, viewer); }
private void hookContextMenu() { MenuManager menuMgr = new MenuManager("#PopupMenu"); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { fillContextMenu(manager); } } ); org.eclipse.swt.widgets.Menu menu = menuMgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, viewer); }
private void setupHierarchyMenu(final TreeViewer viewer) { MenuManager menuMgr = new MenuManager(); Menu menu = menuMgr.createContextMenu(viewer.getControl()); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { ISelection selection = viewer.getSelection(); List<?> choices = Selections.getObjects(selection); if (choices.isEmpty()) { return; } if (choices.size() > 1) { addMultiActions(manager); return; } Object menuElement = Selections.getFirstObject(selection); addItemActions(manager, menuElement); }}); menuMgr.setRemoveAllWhenShown(true); viewer.getControl().setMenu(menu); }
/** Add context menu to axes_table */ private void createContextMenu() { final MenuManager menu = new MenuManager(); menu.setRemoveAllWhenShown(true); menu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { menu.add(new AddAxisAction(operations_manager, model)); if (!axes_table.getSelection().isEmpty()) menu.add(new DeleteAxesAction(operations_manager, axes_table, model)); if (model.getEmptyAxis() != null) menu.add(new RemoveUnusedAxesAction(operations_manager, model)); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); } }); final Table table = axes_table.getTable(); table.setMenu(menu.createContextMenu(table)); }
private void createContextMenu() { MenuManager menuMgr = new MenuManager("#PopupMenu"); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { populateBrowserActions(launchConfiguration, manager); manager.add(new Separator()); manager.add(new Action("&Copy") { @Override public void run() { copySelectionToClipboard(); } }); } }); Menu menu = menuMgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); }
/*********************************************************************** * Select context menu **********************************************************************/ private void hookContextMenu() { MenuManager menuMgr = new MenuManager("#PopupMenu"); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { NavigationView.this.fillContextMenu(manager); } }); Menu menu = menuMgr.createContextMenu(m_procTree.getControl()); m_procTree.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, m_procTree); }
private void createContextMenu() { // Create menu manager. MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager mgr) { fillMenu(mgr, fillContextMenu()); } }); // Create menu. Menu menu = menuMgr.createContextMenu(treeViewer.getControl()); treeViewer.getControl().setMenu(menu); // Register menu for extension. getSite().registerContextMenu(menuMgr, treeViewer); }
/** * hookContextMenu */ private void hookContextMenu() { MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { fillContextMenu(manager); } }); // Create menu. Menu menu = menuMgr.createContextMenu(treeViewer.getControl()); treeViewer.getControl().setMenu(menu); // Register menu for extension. getSite().registerContextMenu(menuMgr, treeViewer); }
/** * create the views context menu */ private void createUI_20_ContextMenu() { final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillContextMenu(manager); } }); final Table table = (Table) _bookmarkViewer.getControl(); final Menu tableContextMenu = menuMgr.createContextMenu(table); _columnManager.createHeaderContextMenu(table, tableContextMenu); }
/** * create the views context menu */ private void createContextMenu() { final MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager menuMgr2) { fillContextMenu(menuMgr2); } }); final Table table = _tourViewer.getTable(); final Menu tableContextMenu = menuMgr.createContextMenu(table); table.setMenu(tableContextMenu); _columnManager.createHeaderContextMenu(table, tableContextMenu); }
/** * create the views context menu */ private void createContextMenu() { final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillContextMenu(manager); } }); final Control viewerControl = _wpViewer.getControl(); final Menu menu = menuMgr.createContextMenu(viewerControl); viewerControl.setMenu(menu); getSite().registerContextMenu(menuMgr, _wpViewer); }
/** * create the views context menu */ private void createUI_20_ContextMenu() { final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillContextMenu(manager); } }); final Table table = (Table) _markerViewer.getControl(); final Menu tableContextMenu = menuMgr.createContextMenu(table); _columnManager.createHeaderContextMenu(table, tableContextMenu); }
private void createUI_12_SliceViewerContextMenu(final Table table) { final MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillSliceContextMenu(manager); } }); final Menu tableContextMenu = menuMgr.createContextMenu(table); _sliceColumnManager.createHeaderContextMenu(table, tableContextMenu); }
/** * create the views context menu */ private void createContextMenu() { final MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager menuMgr2) { // fillContextMenu(menuMgr2); } }); final Tree tree = _colorProfileViewer.getTree(); final Menu treeContextMenu = menuMgr.createContextMenu(tree); tree.setMenu(treeContextMenu); _columnManager.createHeaderContextMenu(tree, treeContextMenu); }
/** * Create context menu for the gallery */ private void createContextMenu() { _contextMenuMgr = new MenuManager(); _contextMenuMgr.setRemoveAllWhenShown(true); _contextMenuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager menuMgr) { fillContextMenu(menuMgr); } }); setMenu(_contextMenuMgr.createContextMenu(this)); }
/** * create the views context menu */ private void createContextMenu() { final MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillContextMenu(manager); } }); final Tree tree = _folderViewer.getTree(); final Menu contextMenu = menuMgr.createContextMenu(tree); tree.setMenu(contextMenu); _picDirView.registerContextMenu(MENU_ID_PIC_DIR_VIEW_IN_FOLDER, menuMgr); }
private void contributeToActionBars() { IActionBars bars = getViewSite().getActionBars(); fillLocalToolBar(bars.getToolBarManager()); IMenuManager dropDownMenu = bars.getMenuManager(); dropDownMenu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { fillTargetMenu(manager); } }); dropDownMenu.add(showErrors); dropDownMenu.add(showConsole); dropDownMenu.add(hideWorkspacePlugins); dropDownMenu.add(loadTarget); dropDownMenu.add(reloadTargets); }
private void createTreeContextMenu(Tree tree) { // Create menu manager. MenuManager menuManager = new MenuManager(); menuManager.setRemoveAllWhenShown(true); menuManager.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager mgr) { fillContextMenu(mgr); } }); // Create menu. Menu menu = menuManager.createContextMenu(tree); tree.setMenu(menu); // Register menu for extension. getSite().registerContextMenu(PLAN_ADVISOR_TREE_CONTEXT_MENU_ID, menuManager, viewer); }
/** * Convenience method for creating a context menu. Will log errors from * the menu listener for easier debugging. * * @param control * @param listener */ public static final MenuManager createContextMenu(Control control, final IMenuListener listener) { // Create menu manager. MenuManager menuManager = new MenuManager(); menuManager.setRemoveAllWhenShown(true); menuManager.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager mgr) { try { listener.menuAboutToShow(mgr); } catch (RuntimeException e) { LogUtil.error("menuAboutToShow", e); throw e; } } }); // Create menu. Menu menu = menuManager.createContextMenu(control); control.setMenu(menu); return menuManager; }
/** * Fills the given view menu with the entries managed by the * group. * * @param viewMenu the menu to fill */ public void fillViewMenu(IMenuManager viewMenu) { /* * Don't change the separator group name. * Using this name ensures that other filters * get contributed to the same group. */ viewMenu.add(new Separator("filters")); //$NON-NLS-1$ viewMenu.add(new GroupMarker(RECENT_FILTERS_GROUP_NAME)); viewMenu.add(new ShowFilterDialogAction()); fMenuManager= viewMenu; fMenuListener= new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { removePreviousLRUFilterActions(manager); addLRUFilterActions(manager); } }; fMenuManager.addMenuListener(fMenuListener); }
private void addRefactorSubmenu(IMenuManager menu) { MenuManager refactorSubmenu= new MenuManager(ActionMessages.RefactorMenu_label, MENU_ID); refactorSubmenu.setActionDefinitionId(QUICK_MENU_ID); if (fEditor != null) { final ITypeRoot element= getEditorInput(); if (element != null && ActionUtil.isOnBuildPath(element)) { refactorSubmenu.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { refactorMenuShown(manager); } }); refactorSubmenu.add(fNoActionAvailable); menu.appendToGroup(fGroupName, refactorSubmenu); } } else { ISelection selection= fSelectionProvider.getSelection(); for (Iterator<SelectionDispatchAction> iter= fActions.iterator(); iter.hasNext(); ) { iter.next().update(selection); } if (fillRefactorMenu(refactorSubmenu) > 0) menu.appendToGroup(fGroupName, refactorSubmenu); } }
@Override public void fillContextMenu(IMenuManager menu) { super.fillContextMenu(menu); if (!canOperateOnSelection()) return; String menuText= ActionMessages.BuildPath_label; IMenuManager subMenu= new MenuManager(menuText, MENU_ID); subMenu.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { fillViewSubMenu(manager); } }); subMenu.setRemoveAllWhenShown(true); subMenu.add(new ConfigureBuildPathAction(fSite)); menu.appendToGroup(fGroupName, subMenu); }
protected void initContextMenu() { final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { menuMgr.add(propertiesAction); menuMgr.add(new Separator()); menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); } }); final Menu menu = menuMgr.createContextMenu(treeTableViewer.getControl()); treeTableViewer.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, treeTableViewer); }
/** * initialize the context menu. */ private void initContextMenu() { MenuManager menuMgr = new MenuManager(); final VPMRefinementBrowser browser = this; menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { Action action = new DeleteRefinementAction(refinementListView, detailsView); manager.add(action); action = new RenameRefinementAction(refinementListView); manager.add(action); action = new RefinementEditDescriptionAction(refinementListView); manager.add(action); action = new ApplySelectedRefinementsAction(browser, "Apply Selected Refinements"); manager.add(action); } }); menuMgr.addMenuListener(new CommandActionMenuListener("org.splevo.ui.commands.argouml.variantscan", SPLevoUIPlugin.getImageDescriptor("icons/kopl_circle_only.png"))); Menu menu = menuMgr.createContextMenu(refinementListView.getTree()); refinementListView.getTree().setMenu(menu); }
@Override public void fillContextMenu(IMenuManager menu) { MenuManager javaSearchMM = new MenuManager(CallHierarchyMessages.SearchScopeActionGroup_searchScope, IContextMenuConstants.GROUP_SEARCH); javaSearchMM.setRemoveAllWhenShown(true); javaSearchMM.addMenuListener(new IMenuListener() { /* (non-Javadoc) * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager) */ public void menuAboutToShow(IMenuManager manager) { fillSearchActions(manager); } }); fillSearchActions(javaSearchMM); menu.appendToGroup(IContextMenuConstants.GROUP_SEARCH, javaSearchMM); }