Search in sources :

Example 66 with MenuManager

use of org.eclipse.jface.action.MenuManager in project sling by apache.

the class JcrPropertiesView method hookContextMenu.

private void hookContextMenu() {
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            JcrPropertiesView.this.fillContextMenu(manager);
        }
    });
    Menu menu = menuMgr.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    IWorkbenchPartSite site = getSite();
    if (site != null) {
        site.registerContextMenu(menuMgr, viewer);
    }
}
Also used : IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) 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 67 with MenuManager

use of org.eclipse.jface.action.MenuManager in project eclipse.platform.text by eclipse.

the class EncodingActionGroup method fillActionBars.

@Override
public void fillActionBars(IActionBars actionBars) {
    IMenuManager menuManager = actionBars.getMenuManager();
    IMenuManager editMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
    if (editMenu != null && fRetargetActions.size() > 0) {
        MenuManager subMenu = new MenuManager(TextEditorMessages.Editor_ConvertEncoding_submenu_label);
        subMenu.addMenuListener(new IMenuListener() {

            @Override
            public void menuAboutToShow(IMenuManager manager) {
                update();
            }
        });
        Iterator<RetargetTextEditorAction> e = fRetargetActions.iterator();
        subMenu.add(e.next());
        subMenu.add(new Separator());
        while (e.hasNext()) subMenu.add(e.next());
        editMenu.add(subMenu);
    }
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) RetargetTextEditorAction(org.eclipse.ui.texteditor.RetargetTextEditorAction) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuListener(org.eclipse.jface.action.IMenuListener) Separator(org.eclipse.jface.action.Separator)

Example 68 with MenuManager

use of org.eclipse.jface.action.MenuManager in project eclipse.platform.text by eclipse.

the class FileSearchPage method addSortActions.

private void addSortActions(IMenuManager mgr) {
    if (getLayout() != FLAG_LAYOUT_FLAT)
        return;
    MenuManager sortMenu = new MenuManager(SearchMessages.FileSearchPage_sort_by_label);
    sortMenu.add(fSortByNameAction);
    sortMenu.add(fSortByPathAction);
    fSortByNameAction.setChecked(fCurrentSortOrder == fSortByNameAction.getSortOrder());
    fSortByPathAction.setChecked(fCurrentSortOrder == fSortByPathAction.getSortOrder());
    mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager)

Example 69 with MenuManager

use of org.eclipse.jface.action.MenuManager in project eclipse.platform.text by eclipse.

the class NewTextSearchActionGroup method addOpenWithMenu.

private void addOpenWithMenu(IMenuManager menu, IStructuredSelection selection) {
    if (selection == null)
        return;
    fOpenAction.selectionChanged(selection);
    if (fOpenAction.isEnabled()) {
        menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fOpenAction);
    }
    if (selection.size() != 1) {
        return;
    }
    Object o = selection.getFirstElement();
    if (!(o instanceof IAdaptable))
        return;
    // Create menu
    IMenuManager submenu = new MenuManager(SearchMessages.OpenWithMenu_label);
    submenu.add(new OpenWithMenu(fPage, (IAdaptable) o));
    // Add the submenu.
    menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) OpenWithMenu(org.eclipse.ui.actions.OpenWithMenu) IMenuManager(org.eclipse.jface.action.IMenuManager)

Example 70 with MenuManager

use of org.eclipse.jface.action.MenuManager in project eclipse.platform.text by eclipse.

the class TextSearchGroup method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    MenuManager textSearchMM = new MenuManager(fMenuText, CTX_MENU_ID);
    int i = 0;
    for (i = 0; i < fActions.length - 1; i++) {
        textSearchMM.add(fActions[i]);
    }
    textSearchMM.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    textSearchMM.add(new Separator());
    textSearchMM.add(fActions[i]);
    menu.appendToGroup(fAppendToGroup, textSearchMM);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

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