Search in sources :

Example 6 with GroupMarker

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

the class SearchView method createViewMenuGroups.

/**
 * Creates the groups and separators for the search view's context menu
 *
 * @param menu the context menu
 */
private static void createViewMenuGroups(IMenuManager menu) {
    menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP));
    menu.add(new Separator(IContextMenuConstants.GROUP_NEW));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_OPEN));
    menu.add(new Separator(IContextMenuConstants.GROUP_SHOW));
    menu.add(new Separator(IContextMenuConstants.GROUP_EDIT));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_REMOVE_MATCHES));
    menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_GENERATE));
    menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
    menu.add(new Separator(IContextMenuConstants.GROUP_BUILD));
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    menu.add(new Separator(IContextMenuConstants.GROUP_FILTERING));
    menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
}
Also used : GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 7 with GroupMarker

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

the class SearchView method createContextMenuGroups.

/**
 * Creates the groups and separators for the search view's context menu
 *
 * @param menu the context menu
 */
public static void createContextMenuGroups(IMenuManager menu) {
    menu.add(new Separator(IContextMenuConstants.GROUP_NEW));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_OPEN));
    menu.add(new Separator(IContextMenuConstants.GROUP_SHOW));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_REMOVE_MATCHES));
    menu.add(new Separator(IContextMenuConstants.GROUP_EDIT));
    menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_GENERATE));
    menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
    menu.add(new Separator(IContextMenuConstants.GROUP_BUILD));
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP));
    menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
}
Also used : GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 8 with GroupMarker

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

the class AbstractTextEditor method editorContextMenuAboutToShow.

/**
 * Sets up this editor's context menu before it is made visible.
 * <p>
 * Subclasses may extend to add other actions.</p>
 *
 * @param menu the menu
 */
protected void editorContextMenuAboutToShow(IMenuManager menu) {
    menu.add(new Separator(ITextEditorActionConstants.GROUP_UNDO));
    menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_SAVE));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_COPY));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_PRINT));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_FIND));
    menu.add(new Separator(IWorkbenchActionConstants.GROUP_ADD));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_REST));
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    if (isEditable()) {
        addAction(menu, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.UNDO);
        addAction(menu, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.REVERT_TO_SAVED);
        addAction(menu, ITextEditorActionConstants.GROUP_SAVE, ITextEditorActionConstants.SAVE);
        addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.CUT);
        addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.COPY);
        addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.PASTE);
        IAction action = getAction(ITextEditorActionConstants.QUICK_ASSIST);
        if (action != null && action.isEnabled())
            addAction(menu, ITextEditorActionConstants.GROUP_EDIT, ITextEditorActionConstants.QUICK_ASSIST);
    } else {
        addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.COPY);
    }
}
Also used : IAction(org.eclipse.jface.action.IAction) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 9 with GroupMarker

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

the class AbstractDecoratedTextEditor method rulerContextMenuAboutToShow.

@Override
protected void rulerContextMenuAboutToShow(IMenuManager menu) {
    /*
		 * XXX: workaround for reliable menu item ordering.
		 * This can be changed once the action contribution story converges,
		 * see http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/platform-ui-home/R3_1/dynamic_teams/dynamic_teams.html#actionContributions
		 */
    // pre-install menus for contributions and call super
    // $NON-NLS-1$
    menu.add(new Separator("debug"));
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_RESTORE));
    // $NON-NLS-1$
    menu.add(new Separator("add"));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_RULERS));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_REST));
    super.rulerContextMenuAboutToShow(menu);
    addRulerContributionActions(menu);
    /* quick diff */
    if (isEditorInputModifiable()) {
        IAction quickdiffAction = getAction(ITextEditorActionConstants.QUICKDIFF_TOGGLE);
        quickdiffAction.setChecked(isChangeInformationShowing());
        menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, quickdiffAction);
        if (isChangeInformationShowing()) {
            TextEditorAction revertLine = new RevertLineAction(this, true);
            TextEditorAction revertSelection = new RevertSelectionAction(this, true);
            TextEditorAction revertBlock = new RevertBlockAction(this, true);
            TextEditorAction revertDeletion = new RestoreAction(this, true);
            revertSelection.update();
            revertBlock.update();
            revertLine.update();
            revertDeletion.update();
            // only add block action if selection action is not enabled
            if (revertSelection.isEnabled())
                menu.appendToGroup(ITextEditorActionConstants.GROUP_RESTORE, revertSelection);
            else if (revertBlock.isEnabled())
                menu.appendToGroup(ITextEditorActionConstants.GROUP_RESTORE, revertBlock);
            if (revertLine.isEnabled())
                menu.appendToGroup(ITextEditorActionConstants.GROUP_RESTORE, revertLine);
            if (revertDeletion.isEnabled())
                menu.appendToGroup(ITextEditorActionConstants.GROUP_RESTORE, revertDeletion);
        }
    }
    // revision info
    if (fLineColumn != null && fLineColumn.isShowingRevisionInformation()) {
        IMenuManager revisionMenu = new MenuManager(TextEditorMessages.AbstractDecoratedTextEditor_revisions_menu);
        menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, revisionMenu);
        IAction hideRevisionInfoAction = getAction(ITextEditorActionConstants.REVISION_HIDE_INFO);
        revisionMenu.add(hideRevisionInfoAction);
        revisionMenu.add(new Separator());
        String[] labels = { TextEditorMessages.AbstractDecoratedTextEditor_revision_colors_option_by_date, TextEditorMessages.AbstractDecoratedTextEditor_revision_colors_option_by_author, TextEditorMessages.AbstractDecoratedTextEditor_revision_colors_option_by_author_and_date };
        final RenderingMode[] modes = { IRevisionRulerColumnExtension.AGE, IRevisionRulerColumnExtension.AUTHOR, IRevisionRulerColumnExtension.AUTHOR_SHADED_BY_AGE };
        final IPreferenceStore uiStore = EditorsUI.getPreferenceStore();
        String current = uiStore.getString(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_RENDERING_MODE);
        for (int i = 0; i < modes.length; i++) {
            final String mode = modes[i].name();
            IAction action = new Action(labels[i], IAction.AS_RADIO_BUTTON) {

                @Override
                public void run() {
                    // set preference globally, LineNumberColumn reacts on preference change
                    uiStore.setValue(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_RENDERING_MODE, mode);
                }
            };
            action.setChecked(mode.equals(current));
            revisionMenu.add(action);
        }
        revisionMenu.add(new Separator());
        IAction action = getAction(ITextEditorActionConstants.REVISION_SHOW_AUTHOR_TOGGLE);
        if (action instanceof IUpdate)
            ((IUpdate) action).update();
        revisionMenu.add(action);
        action = getAction(ITextEditorActionConstants.REVISION_SHOW_ID_TOGGLE);
        if (action instanceof IUpdate)
            ((IUpdate) action).update();
        revisionMenu.add(action);
    }
    IAction lineNumberAction = getAction(ITextEditorActionConstants.LINENUMBERS_TOGGLE);
    lineNumberAction.setChecked(fLineColumn != null && fLineColumn.isShowingLineNumbers());
    menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, lineNumberAction);
    IAction preferencesAction = getAction(ITextEditorActionConstants.RULER_PREFERENCES);
    menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, new Separator(ITextEditorActionConstants.GROUP_SETTINGS));
    menu.appendToGroup(ITextEditorActionConstants.GROUP_SETTINGS, preferencesAction);
}
Also used : RevertSelectionAction(org.eclipse.ui.internal.editors.quickdiff.RevertSelectionAction) RevertLineAction(org.eclipse.ui.internal.editors.quickdiff.RevertLineAction) RevertBlockAction(org.eclipse.ui.internal.editors.quickdiff.RevertBlockAction) BooleanPreferenceToggleAction(org.eclipse.ui.internal.texteditor.BooleanPreferenceToggleAction) RevertSelectionAction(org.eclipse.ui.internal.editors.quickdiff.RevertSelectionAction) CompositeRevertAction(org.eclipse.ui.internal.editors.quickdiff.CompositeRevertAction) RestoreAction(org.eclipse.ui.internal.editors.quickdiff.RestoreAction) IAction(org.eclipse.jface.action.IAction) RefreshEditorAction(org.eclipse.ui.internal.editors.text.RefreshEditorAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) RestoreAction(org.eclipse.ui.internal.editors.quickdiff.RestoreAction) RevertBlockAction(org.eclipse.ui.internal.editors.quickdiff.RevertBlockAction) Point(org.eclipse.swt.graphics.Point) RevertLineAction(org.eclipse.ui.internal.editors.quickdiff.RevertLineAction) RenderingMode(org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension.RenderingMode) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) IMenuManager(org.eclipse.jface.action.IMenuManager) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Separator(org.eclipse.jface.action.Separator)

Example 10 with GroupMarker

use of org.eclipse.jface.action.GroupMarker in project linuxtools by eclipse.

the class UIUtils method createContextMenu.

/**
 * Creates context menu to a given control.
 *
 * @param control
 *            the control
 *
 * @return the i menu manager
 */
public static IMenuManager createContextMenu(final Control control) {
    Assert.isTrue(control != null && !control.isDisposed());
    MenuManager menuManager = new MenuManager();
    menuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    Menu menu = menuManager.createContextMenu(control);
    control.setMenu(menu);
    return menuManager;
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) Menu(org.eclipse.swt.widgets.Menu)

Aggregations

GroupMarker (org.eclipse.jface.action.GroupMarker)117 Separator (org.eclipse.jface.action.Separator)93 IMenuManager (org.eclipse.jface.action.IMenuManager)44 MenuManager (org.eclipse.jface.action.MenuManager)42 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)17 IToolBarManager (org.eclipse.jface.action.IToolBarManager)12 IAction (org.eclipse.jface.action.IAction)10 IMenuListener (org.eclipse.jface.action.IMenuListener)10 Menu (org.eclipse.swt.widgets.Menu)8 Action (org.eclipse.jface.action.Action)7 ISelection (org.eclipse.jface.viewers.ISelection)5 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)5 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)4 ToolBarContributionItem (org.eclipse.jface.action.ToolBarContributionItem)4 ToolBarManager (org.eclipse.jface.action.ToolBarManager)4 Iterator (java.util.Iterator)2 AddPVAction (org.csstudio.trends.databrowser3.ui.AddPVAction)2 IFindReplaceTarget (org.eclipse.jface.text.IFindReplaceTarget)2 Point (org.eclipse.swt.graphics.Point)2 Shell (org.eclipse.swt.widgets.Shell)2