Search in sources :

Example 91 with MenuManager

use of org.eclipse.jface.action.MenuManager in project core by jcryptool.

the class ActionView method hookContextMenu.

private void hookContextMenu() {
    MenuManager manager = new MenuManager();
    manager.setRemoveAllWhenShown(true);
    Menu menu = manager.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    // $NON-NLS-1$
    getSite().registerContextMenu("org.jcryptool.actions.popup", manager, viewer);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) Menu(org.eclipse.swt.widgets.Menu)

Example 92 with MenuManager

use of org.eclipse.jface.action.MenuManager in project core by jcryptool.

the class ApplicationActionBarAdvisor method createEditMenu.

private IMenuManager createEditMenu() {
    MenuManager menu = new MenuManager(Messages.applicationActionBarAdvisor_Menu_Edit, IWorkbenchActionConstants.M_EDIT);
    menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
    IServiceLocator serviceLocator = PlatformUI.getWorkbench();
    // undo, redo
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_UNDO));
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_REDO));
    menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
    menu.add(new Separator());
    // cut, copy, paste
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_CUT));
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_COPY));
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_PASTE));
    menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
    menu.add(new Separator());
    // delete, select all
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_DELETE));
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_SELECT_ALL));
    menu.add(new Separator());
    // find
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE));
    menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
    menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));
    // provide a uniform location for the "show in" or "open with" actions
    // $NON-NLS-1$
    MenuManager showin = new MenuManager(Messages.ApplicationActionBarAdvisor_1, "showin");
    // $NON-NLS-1$
    showin.add(new GroupMarker("start"));
    menu.add(showin);
    menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    return menu;
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IServiceLocator(org.eclipse.ui.services.IServiceLocator) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 93 with MenuManager

use of org.eclipse.jface.action.MenuManager in project core by jcryptool.

the class ApplicationActionBarAdvisor method fillCoolBar.

@Override
protected void fillCoolBar(ICoolBarManager coolBar) {
    // ToolBar File & Additions
    IToolBarManager fileToolBar = new ToolBarManager(coolBar.getStyle());
    IServiceLocator serviceLocator = PlatformUI.getWorkbench();
    fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
    fileToolBar.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.FILE_SAVE));
    fileToolBar.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.FILE_SAVE_ALL));
    fileToolBar.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.FILE_PRINT));
    fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
    fileToolBar.add(new Separator());
    fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    // $NON-NLS-1$
    coolBar.add(new ToolBarContributionItem(fileToolBar, CorePlugin.PLUGIN_ID + ".toolbar"));
    // ToolBar Help
    IToolBarManager helpToolBar = new ToolBarManager(coolBar.getStyle());
    // $NON-NLS-1$
    coolBar.add(new ToolBarContributionItem(helpToolBar, CorePlugin.PLUGIN_ID + ".helpToolBar"));
    // CoolBar Context Menu
    // $NON-NLS-1$
    MenuManager coolBarContextMenuManager = new MenuManager(null, CorePlugin.PLUGIN_ID + ".contextMenu");
    coolBar.setContextMenuManager(coolBarContextMenuManager);
    coolBarContextMenuManager.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.WINDOW_LOCK_TOOLBAR));
    coolBarContextMenuManager.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.WINDOW_CUSTOMIZE_PERSPECTIVE));
    coolBarContextMenuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}
Also used : ToolBarContributionItem(org.eclipse.jface.action.ToolBarContributionItem) IToolBarManager(org.eclipse.jface.action.IToolBarManager) IServiceLocator(org.eclipse.ui.services.IServiceLocator) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager) Separator(org.eclipse.jface.action.Separator)

Example 94 with MenuManager

use of org.eclipse.jface.action.MenuManager in project core by jcryptool.

the class FlexiProviderOperationsView method hookContextMenu.

// private IExtendedOperationDescriptor currentOperation;
private void hookContextMenu() {
    // $NON-NLS-1$
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            if (viewer.getTree().getSelection().length > 0) {
                Object selection = viewer.getTree().getSelection()[0].getData();
                if (selection instanceof TreeNode) {
                    currentEntryNode = getCurrentEntryNode((TreeNode) selection);
                }
                if (selection instanceof EntryNode) {
                    fillEntryNodeContextMenu(manager);
                } else if (selection instanceof OperationsNode) {
                    if (displayOperationContextMenu(currentEntryNode)) {
                        fillEncryptDecryptNodeContextMenu(manager);
                    }
                } else if (selection instanceof InputNode) {
                    fillInputContextMenu(manager);
                } else if (selection instanceof OutputNode) {
                    fillOutputContextMenu(manager);
                } else if (selection instanceof SignatureNode) {
                    fillSignatureOutputContextMenu(manager);
                } else if (selection instanceof KeyNode) {
                    fillKeyNodeContextMenu(manager);
                }
            }
        }
    });
    Menu menu = menuMgr.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    getSite().registerContextMenu("org.jcryptool.crypto.flexiprovider.operations.popup", menuMgr, viewer);
}
Also used : InputNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.InputNode) OutputNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.OutputNode) TreeNode(org.jcryptool.crypto.flexiprovider.ui.nodes.TreeNode) ITreeNode(org.jcryptool.crypto.flexiprovider.ui.nodes.ITreeNode) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) EntryNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.EntryNode) KeyNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.keys.KeyNode) IMenuManager(org.eclipse.jface.action.IMenuManager) OperationsNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.ops.OperationsNode) Menu(org.eclipse.swt.widgets.Menu) SignatureNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.SignatureNode) IMenuListener(org.eclipse.jface.action.IMenuListener)

Example 95 with MenuManager

use of org.eclipse.jface.action.MenuManager in project tmdm-studio-se by Talend.

the class DataModelMainPage method hookTypesContextMenu.

private void hookTypesContextMenu() {
    typesMenuMgr = new MenuManager();
    typesMenuMgr.setRemoveAllWhenShown(true);
    typesMenuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            DataModelMainPage.this.fillContextMenu(manager, true);
        }
    });
    Menu menu = typesMenuMgr.createContextMenu(typesViewer.getControl());
    typesViewer.getControl().setMenu(menu);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) IMenuListener(org.eclipse.jface.action.IMenuListener)

Aggregations

MenuManager (org.eclipse.jface.action.MenuManager)657 IMenuManager (org.eclipse.jface.action.IMenuManager)498 Menu (org.eclipse.swt.widgets.Menu)303 IMenuListener (org.eclipse.jface.action.IMenuListener)246 Separator (org.eclipse.jface.action.Separator)220 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)65 Point (org.eclipse.swt.graphics.Point)63 Action (org.eclipse.jface.action.Action)55 Composite (org.eclipse.swt.widgets.Composite)49 IAction (org.eclipse.jface.action.IAction)48 SelectionEvent (org.eclipse.swt.events.SelectionEvent)44 GridData (org.eclipse.swt.layout.GridData)44 GroupMarker (org.eclipse.jface.action.GroupMarker)43 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)43 Transfer (org.eclipse.swt.dnd.Transfer)35 GridLayout (org.eclipse.swt.layout.GridLayout)32 List (java.util.List)30 EditingDomainViewerDropAdapter (org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter)30 LocalTransfer (org.eclipse.emf.edit.ui.dnd.LocalTransfer)30 ViewerDragAdapter (org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter)30