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));
}
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));
}
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);
}
}
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);
}
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;
}
Aggregations