org.eclipse.jface.action.MenuManager Java Examples
The following examples show how to use
org.eclipse.jface.action.MenuManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ItemEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor ( StructuredViewer viewer ) { MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$ contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$ contextMenu.setRemoveAllWhenShown ( true ); contextMenu.addMenuListener ( this ); Menu menu = contextMenu.createContextMenu ( viewer.getControl () ); viewer.getControl ().setMenu ( menu ); getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) ); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () }; viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) ); viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) ); }
Example #2
Source File: SecurityEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor ( StructuredViewer viewer ) { MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$ contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$ contextMenu.setRemoveAllWhenShown ( true ); contextMenu.addMenuListener ( this ); Menu menu = contextMenu.createContextMenu ( viewer.getControl () ); viewer.getControl ().setMenu ( menu ); getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) ); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () }; viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) ); viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) ); }
Example #3
Source File: RefactorActionGroup.java From typescript.java with MIT License | 6 votes |
private void refactorMenuShown(IMenuManager refactorSubmenu) { // we know that we have an MenuManager since we created it in // addRefactorSubmenu. Menu menu = ((MenuManager) refactorSubmenu).getMenu(); menu.addMenuListener(new MenuAdapter() { @Override public void menuHidden(MenuEvent e) { refactorMenuHidden(); } }); ITextSelection textSelection = (ITextSelection) fEditor.getSelectionProvider().getSelection(); // JavaTextSelection javaSelection= new // JavaTextSelection(getEditorInput(), getDocument(), // textSelection.getOffset(), textSelection.getLength()); for (Iterator<SelectionDispatchAction> iter = fActions.iterator(); iter.hasNext();) { SelectionDispatchAction action = iter.next(); action.update(textSelection); } refactorSubmenu.removeAll(); if (fillRefactorMenu(refactorSubmenu) == 0) refactorSubmenu.add(fNoActionAvailable); }
Example #4
Source File: CallHierarchyViewPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void fillViewMenu() { IActionBars actionBars = getViewSite().getActionBars(); IMenuManager viewMenu = actionBars.getMenuManager(); viewMenu.add(new Separator()); for (int i = 0; i < fToggleCallModeActions.length; i++) { viewMenu.add(fToggleCallModeActions[i]); } viewMenu.add(new Separator()); MenuManager layoutSubMenu= new MenuManager(CallHierarchyMessages.CallHierarchyViewPart_layout_menu); for (int i = 0; i < fToggleOrientationActions.length; i++) { layoutSubMenu.add(fToggleOrientationActions[i]); } viewMenu.add(layoutSubMenu); viewMenu.add(new Separator(IContextMenuConstants.GROUP_SEARCH)); MenuManager fieldSubMenu= new MenuManager(CallHierarchyMessages.CallHierarchyViewPart_field_menu); for (int i = 0; i < fToggleFieldModeActions.length; i++) { fieldSubMenu.add(fToggleFieldModeActions[i]); } viewMenu.add(fieldSubMenu); viewMenu.add(fShowSearchInDialogAction); }
Example #5
Source File: MemoryEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor ( StructuredViewer viewer ) { MenuManager contextMenu = new MenuManager ( "#PopUp" ); contextMenu.add ( new Separator ( "additions" ) ); contextMenu.setRemoveAllWhenShown ( true ); contextMenu.addMenuListener ( this ); Menu menu = contextMenu.createContextMenu ( viewer.getControl () ); viewer.getControl ().setMenu ( menu ); getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) ); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () }; viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) ); viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) ); }
Example #6
Source File: NatTableWrapper.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public void addContextMenu(String string, IWorkbenchPartSite iWorkbenchPartSite){ MenuManager mgr = new MenuManager(); Menu popupmenu = new PopupMenuBuilder(natTable, mgr).build(); iWorkbenchPartSite.registerContextMenu(string, mgr, null); natTable.addConfiguration(new AbstractUiBindingConfiguration() { @Override public void configureUiBindings(UiBindingRegistry uiBindingRegistry){ uiBindingRegistry.registerMouseDownBinding( new MouseEventMatcher(SWT.NONE, null, MouseEventMatcher.RIGHT_BUTTON), new PopupMenuAction(popupmenu)); } }); }
Example #7
Source File: GenconfEditor.java From M2Doc with Eclipse Public License 1.0 | 6 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ protected void createContextMenuFor(StructuredViewer viewer) { MenuManager contextMenu = new MenuManager("#PopUp"); contextMenu.add(new Separator("additions")); contextMenu.setRemoveAllWhenShown(true); contextMenu.addMenuListener(this); Menu menu = contextMenu.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] {LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance()}; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); }
Example #8
Source File: RecipeActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution * item <code>contributionID</code>. * If <code>contributionID</code> is <code>null</code>, they are simply added. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID ) { if ( submenuActions != null ) { for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () ) { MenuManager submenuManager = new MenuManager ( entry.getKey () ); if ( contributionID != null ) { manager.insertBefore ( contributionID, submenuManager ); } else { manager.add ( submenuManager ); } populateManager ( submenuManager, entry.getValue (), null ); } } }
Example #9
Source File: RecipeEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor ( StructuredViewer viewer ) { MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$ contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$ contextMenu.setRemoveAllWhenShown ( true ); contextMenu.addMenuListener ( this ); Menu menu = contextMenu.createContextMenu ( viewer.getControl () ); viewer.getControl ().setMenu ( menu ); getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) ); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () }; viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) ); viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) ); }
Example #10
Source File: InfrastructureEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor ( StructuredViewer viewer ) { MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$ contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$ contextMenu.setRemoveAllWhenShown ( true ); contextMenu.addMenuListener ( this ); Menu menu = contextMenu.createContextMenu ( viewer.getControl () ); viewer.getControl ().setMenu ( menu ); getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) ); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () }; viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) ); viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) ); }
Example #11
Source File: TmMatchEditorBodyMenu.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
private void createMenu() { MenuManager menuMgr = new MenuManager(); bodyMenu = menuMgr.createContextMenu(viewer.getControl()); copyAction = new CopyAction(); cutAction = new CutAction(); pasteAction = new PasteAction(); undoAction = new UndoAction(); redoAction = new RedoAction(); menuMgr.add(undoAction); menuMgr.add(redoAction); menuMgr.add(new Separator()); menuMgr.add(copyAction); menuMgr.add(cutAction); menuMgr.add(pasteAction); }
Example #12
Source File: ItemActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution * item <code>contributionID</code>. * If <code>contributionID</code> is <code>null</code>, they are simply added. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID ) { if ( submenuActions != null ) { for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () ) { MenuManager submenuManager = new MenuManager ( entry.getKey () ); if ( contributionID != null ) { manager.insertBefore ( contributionID, submenuManager ); } else { manager.add ( submenuManager ); } populateManager ( submenuManager, entry.getValue (), null ); } } }
Example #13
Source File: ApplicationActionBarAdvisor.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 创建工具菜单 * @return 返回工具菜单的 menu manager; */ private MenuManager createToolMenu() { MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.tool"), "net.heartsome.cat.ts.ui.menu.tool") { @Override public boolean isVisible() { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (workbenchWindow == null) return false; IWorkbenchPage activePage = workbenchWindow.getActivePage(); if (activePage == null) return false; if (activePage.getPerspective().getId().contains("net.heartsome.cat.ts.perspective")) return true; return false; } }; // &Tool menu.add(new GroupMarker("pluginConfigure")); menu.add(new GroupMarker("preference.groupMarker")); // menu.add(preferenceAction); return menu; }
Example #14
Source File: PluginConfigManage.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public void updataPluginMenu(PluginConfigBean bean) { String id = bean.getId(); for (int i = 0; i < parentManager.getItems().length; i++) { if ("net.heartsome.cat.ts.ui.menu.plugin".equals(parentManager.getItems()[i].getId())) { MenuManager pluginMenu = (MenuManager) parentManager.getItems()[i]; // 开始删除已经添加的菜单 for (int j = 0; j < pluginMenu.getItems().length; j++) { String actionId = pluginMenu.getItems()[j].getId(); if (id.equals(actionId)) { pluginMenu.remove(id); pluginMenu.update(); addPluginMenu(bean); } } } } }
Example #15
Source File: WriteReferencesSearchGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void fillContextMenu(IMenuManager manager) { MenuManager javaSearchMM= new MenuManager(MENU_TEXT, IContextMenuConstants.GROUP_SEARCH); addAction(fFindWriteReferencesAction, javaSearchMM); addAction(fFindWriteReferencesInProjectAction, javaSearchMM); addAction(fFindWriteReferencesInHierarchyAction, javaSearchMM); javaSearchMM.add(new Separator()); Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator(); while (iter.hasNext()) { addWorkingSetAction(iter.next(), javaSearchMM); } addAction(fFindWriteReferencesInWorkingSetAction, javaSearchMM); if (!javaSearchMM.isEmpty()) manager.appendToGroup(fGroupId, javaSearchMM); }
Example #16
Source File: DeploymentActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s * contained in the <code>submenuActions</code> map. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions ) { if ( submenuActions != null ) { IContributionItem[] items = manager.getItems (); for ( int i = 0; i < items.length; i++ ) { IContributionItem contributionItem = items[i]; if ( contributionItem instanceof MenuManager ) { MenuManager submenuManager = (MenuManager)contributionItem; if ( submenuActions.containsKey ( submenuManager.getMenuText () ) ) { depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) ); manager.remove ( contributionItem ); } } } } }
Example #17
Source File: ReferencesSearchGroup.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
@Override public void fillContextMenu(IMenuManager menu) { super.fillContextMenu(menu); IMenuManager incomingMenu = menu; IMenuManager declarationsMenu = new MenuManager(Messages.ReferencesSearchGroup_References, IContextMenuConstants.GROUP_SEARCH); if (editor != null){ menu.appendToGroup(ITextEditorActionConstants.GROUP_FIND, declarationsMenu); } else { incomingMenu.appendToGroup(IContextMenuConstants.GROUP_SEARCH, declarationsMenu); } incomingMenu = declarationsMenu; incomingMenu.add(findReferencesAction); incomingMenu.add(findReferencesProjectAction); }
Example #18
Source File: DetailViewEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor ( StructuredViewer viewer ) { MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$ contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$ contextMenu.setRemoveAllWhenShown ( true ); contextMenu.addMenuListener ( this ); Menu menu = contextMenu.createContextMenu ( viewer.getControl () ); viewer.getControl ().setMenu ( menu ); getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) ); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () }; viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) ); viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) ); }
Example #19
Source File: BibtexEntryView.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
private void hookContextMenu() { MenuManager menuMgr = new MenuManager("#PopupMenu"); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if(s.getFirstElement() instanceof DocumentImpl) { fillContextMenu(manager); } } }); Menu menu = menuMgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, viewer); }
Example #20
Source File: SelectAllProjectExplorer_PluginUITest.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * Asserts that the context menu for the current navigator selection does not contain any duplicates. * * That is, two menu items that represent an action of the same class. */ private void assertContextMenuNoActionDuplicates() { MenuManager menu = new MenuManager(); projectExplorer.getNavigatorActionService().fillContextMenu(menu); List<ActionContributionItem> actionContributions = Arrays.asList(menu.getItems()).stream() .filter(i -> i instanceof ActionContributionItem) .map(i -> ((ActionContributionItem) i)) .collect(Collectors.toList()); Map<String, ActionContributionItem> contributionNameMap = new HashMap<>(); for (ActionContributionItem item : actionContributions) { ActionContributionItem mapItem = contributionNameMap.putIfAbsent(item.getAction().getText(), item); if (mapItem != null) { IAction mapAction = mapItem.getAction(); IAction otherAction = item.getAction(); // Double check if action is of the same type if (mapAction.getClass().equals(otherAction.getClass())) { fail("Action '" + mapAction.getClass().getSimpleName() + "' is contributed twice to the context menu: " + mapAction.toString() + " " + otherAction.toString()); } } } }
Example #21
Source File: RefactorActionGroup.java From typescript.java with MIT License | 6 votes |
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); } }
Example #22
Source File: GWTOpenEditorActionGroup.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
private void addOpenWithMenu(IMenuManager menu) { ISelection selection = getContext().getSelection(); if (selection.isEmpty() || !(selection instanceof IStructuredSelection)) { return; } IStructuredSelection ss = (IStructuredSelection) selection; if (ss.size() != 1) { return; } Object o = ss.getFirstElement(); IFile file = AdapterUtilities.getAdapter(o, IFile.class); if (file == null) { return; } // Create a menu. IMenuManager submenu = new MenuManager(ActionMessages.OpenWithMenu_label); submenu.add(new OpenWithMenu(site.getPage(), file)); // Add the submenu. menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu); }
Example #23
Source File: GraphStatsView.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Adds the actions to the tableviewer context menu. * * @param actions * a collection of IAction objets */ private void hookContextMenu(final Collection<Object> actions, StructuredViewer viewer) { MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { for (Iterator<Object> iter = actions.iterator(); iter.hasNext();) { Object item = iter.next(); if (item instanceof IContributionItem) { manager.add((IContributionItem) item); } else if (item instanceof IAction) { manager.add((IAction) item); } } manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); } }); Menu menu = menuMgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, viewer); }
Example #24
Source File: EipEditor.java From eip-designer with Apache License 2.0 | 5 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor(StructuredViewer viewer) { MenuManager contextMenu = new MenuManager("#PopUp"); contextMenu.add(new Separator("additions")); contextMenu.setRemoveAllWhenShown(true); contextMenu.addMenuListener(this); Menu menu= contextMenu.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); }
Example #25
Source File: FactoryEditor.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private void hookContextMenu ( final IEditorSite editorSite ) { 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 Menu menu = menuMgr.createContextMenu ( this.viewer.getControl () ); this.viewer.getControl ().setMenu ( menu ); editorSite.registerContextMenu ( menuMgr, this.viewer ); }
Example #26
Source File: CoreEditor.java From ifml-editor with MIT License | 5 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor(StructuredViewer viewer) { MenuManager contextMenu = new MenuManager("#PopUp"); contextMenu.add(new Separator("additions")); contextMenu.setRemoveAllWhenShown(true); contextMenu.addMenuListener(this); Menu menu= contextMenu.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); }
Example #27
Source File: EclipseTabProvider.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public EclipseTabProvider ( final Composite parent ) { this.folder = new CTabFolder ( parent, SWT.TOP | SWT.FLAT | SWT.BORDER ); this.folder.setTabHeight ( 24 ); this.folder.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) ); this.mgr = new MenuManager (); final Menu menu = this.mgr.createContextMenu ( this.folder ); this.folder.setMenu ( menu ); }
Example #28
Source File: DataViewTreeViewerPage.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates the context menu */ private void createContextMenus( ) { MenuManager menuManager = new ViewContextMenuProvider( getTreeViewer( ) ); Menu menu = menuManager.createContextMenu( getTreeViewer( ).getControl( ) ); getTreeViewer( ).getControl( ).setMenu( menu ); getSite( ).registerContextMenu( "#Pop up", menuManager, //$NON-NLS-1$ getSite( ).getSelectionProvider( ) ); }
Example #29
Source File: WebBrowserViewer4Mac.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
protected MenuManager createContextMenu() { MenuManager menuManager = new MenuManager("#Popup"); //$NON-NLS-1$ menuManager.add(backAction); menuManager.add(forwardAction); menuManager.add(refreshAction); ((Control) browser).setMenu(menuManager .createContextMenu((Control) browser)); return menuManager; }
Example #30
Source File: NativeTabProvider.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public NativeTabProvider ( final Composite box ) { this.folder = new TabFolder ( box, SWT.NONE ); this.folder.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) ); this.mgr = new MenuManager (); final Menu menu = this.mgr.createContextMenu ( this.folder ); this.folder.setMenu ( menu ); }