Search in sources :

Example 1 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project GT by Tencent.

the class DevicesView method createSourContextMenu.

private void createSourContextMenu() {
    MenuManager menuMgr = new MenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            DevicesView.this.fillSourContextMenu(manager);
        }
    });
    Menu menu = menuMgr.createContextMenu(sourcePkgTableViewer.getControl());
    sourcePkgTableViewer.getControl().setMenu(menu);
    getSite().registerContextMenu(menuMgr, sourcePkgTableViewer);
}
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)

Example 2 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project GT by Tencent.

the class APTSMAPSCTabItem method createContextMenu.

private void createContextMenu() {
    MenuManager menuMgr = new MenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            APTSMAPSCTabItem.this.fillContextMenu(manager);
        }
    });
    Menu menu = menuMgr.createContextMenu(viewer.getControl());
    viewer.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)

Example 3 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project dbeaver by serge-rider.

the class HexManager method createEditorPart.

/**
     * Creates editor part of parent application. Can only be called once per Manager object.
     *
     * @param parent composite where the part will be drawn.
     * @throws IllegalStateException when editor part exists already (method called twice or more)
     * @throws NullPointerException  if textsParent is null
     */
public Composite createEditorPart(Composite parent, int style) {
    if (hexEditControl != null)
        throw new IllegalStateException("Editor part exists already");
    if (parent == null)
        throw new NullPointerException("Null parent");
    textsParent = parent;
    hexEditControl = new HexEditControl(textsParent, style);
    hexEditControl.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            if (fontText != null && !fontText.isDisposed())
                fontText.dispose();
        }
    });
    if (fontData != null) {
        fontText = new Font(Display.getCurrent(), fontData);
        hexEditControl.setFont(fontText);
    }
    //hexEditControl.addLongSelectionListener(new ControlSelectionAdapter(ControlSelectionAdapter.UPDATE_POSITION_TEXT));
    hexEditControl.addListener(SWT.Modify, new Listener() {

        @Override
        public void handleEvent(Event event) {
            if (statusLine != null)
                statusLine.updateInsertModeText(hexEditControl == null || !hexEditControl.isOverwriteMode());
        }
    });
    if (listOfStatusChangedListeners != null) {
        for (Listener listOfStatusChangedListener : listOfStatusChangedListeners) {
            hexEditControl.addListener(SWT.Modify, listOfStatusChangedListener);
        }
        listOfStatusChangedListeners = null;
    }
    if (listOfLongListeners != null) {
        for (SelectionListener listOfLongListener : listOfLongListeners) {
            hexEditControl.addLongSelectionListener(listOfLongListener);
        }
        listOfLongListeners = null;
    }
    {
        // Context menu
        MenuManager menuManager = new MenuManager();
        menuManager.setRemoveAllWhenShown(true);
        menuManager.addMenuListener(new IMenuListener() {

            @Override
            public void menuAboutToShow(IMenuManager manager) {
                if (menuListener != null) {
                    menuListener.menuAboutToShow(manager);
                }
            }
        });
        Menu contextMenu = menuManager.createContextMenu(hexEditControl.getHexText());
        hexEditControl.getHexText().setMenu(contextMenu);
        contextMenu = menuManager.createContextMenu(hexEditControl.getPreviewText());
        hexEditControl.getPreviewText().setMenu(contextMenu);
    //getSite().registerContextMenu(menuManager, this);
    }
    return hexEditControl;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) DisposeListener(org.eclipse.swt.events.DisposeListener) IMenuListener(org.eclipse.jface.action.IMenuListener) SelectionListener(org.eclipse.swt.events.SelectionListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) Font(org.eclipse.swt.graphics.Font) IMenuListener(org.eclipse.jface.action.IMenuListener) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) DisposeEvent(org.eclipse.swt.events.DisposeEvent) IMenuManager(org.eclipse.jface.action.IMenuManager) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 4 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project translationstudio8 by heartsome.

the class PortingActionProvider method addImportMenu.

private void addImportMenu(IMenuManager aMenu) {
    importWizardActionGroup.setContext(getContext());
    if (importWizardActionGroup.getWizardActionIds().length == 0) {
        aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, importAction);
        return;
    }
    IMenuManager submenu = new MenuManager(WorkbenchNavigatorMessages.PortingActionProvider_ImportResourcesMenu_label, COMMON_NAVIGATOR_IMPORT_MENU);
    importWizardActionGroup.fillContextMenu(submenu);
    submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
    submenu.add(new Separator());
    submenu.add(importAction);
    aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 5 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project translationstudio8 by heartsome.

the class ApplicationActionBarAdvisor method fillMenuBar.

protected void fillMenuBar(IMenuManager menuBar) {
    MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
    menuBar.add(fileMenu);
    fileMenu.add(exitAction);
    MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
    menuBar.add(editMenu);
    editMenu.add(preferenceAction);
}
Also used : IMenuManager(org.eclipse.jface.action.IMenuManager) MenuManager(org.eclipse.jface.action.MenuManager)

Aggregations

IMenuManager (org.eclipse.jface.action.IMenuManager)88 MenuManager (org.eclipse.jface.action.MenuManager)72 IMenuListener (org.eclipse.jface.action.IMenuListener)48 Menu (org.eclipse.swt.widgets.Menu)43 Separator (org.eclipse.jface.action.Separator)31 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)16 IAction (org.eclipse.jface.action.IAction)9 TreeViewer (org.eclipse.jface.viewers.TreeViewer)9 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)8 GridData (org.eclipse.swt.layout.GridData)8 Action (org.eclipse.jface.action.Action)7 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)7 Composite (org.eclipse.swt.widgets.Composite)7 GridLayout (org.eclipse.swt.layout.GridLayout)6 List (java.util.List)5 ICoolBarManager (org.eclipse.jface.action.ICoolBarManager)5 FocusEvent (org.eclipse.swt.events.FocusEvent)5 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)4 IContributionItem (org.eclipse.jface.action.IContributionItem)4 Point (org.eclipse.swt.graphics.Point)4