use of org.eclipse.ui.internal.editors.quickdiff.CompositeRevertAction in project eclipse.platform.text by eclipse.
the class AbstractDecoratedTextEditor method createActions.
@Override
protected void createActions() {
super.createActions();
// $NON-NLS-1$
ResourceAction action = new AddMarkerAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.AddBookmark.", this, IMarker.BOOKMARK, true);
action.setHelpContextId(ITextEditorHelpContextIds.BOOKMARK_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_ADD_BOOKMARK);
setAction(IDEActionFactory.BOOKMARK.getId(), action);
// $NON-NLS-1$
action = new AddTaskAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.AddTask.", this);
action.setHelpContextId(ITextEditorHelpContextIds.ADD_TASK_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_ADD_TASK);
setAction(IDEActionFactory.ADD_TASK.getId(), action);
// $NON-NLS-1$
action = new ChangeEncodingAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ChangeEncodingAction.", this);
action.setHelpContextId(ITextEditorHelpContextIds.CHANGE_ENCODING);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.CHANGE_ENCODING);
setAction(ITextEditorActionConstants.CHANGE_ENCODING, action);
markAsPropertyDependentAction(ITextEditorActionConstants.CHANGE_ENCODING, true);
action = new // $NON-NLS-1$
ResourceAction(// $NON-NLS-1$
TextEditorMessages.getBundleForConstructedKeys(), // $NON-NLS-1$
"Editor.ToggleLineNumbersAction.", // $NON-NLS-1$
IAction.AS_CHECK_BOX) {
@Override
public void run() {
toggleLineNumberRuler();
}
};
action.setActionDefinitionId(ITextEditorActionDefinitionIds.LINENUMBER_TOGGLE);
setAction(ITextEditorActionConstants.LINENUMBERS_TOGGLE, action);
action = new // $NON-NLS-1$
ResourceAction(// $NON-NLS-1$
TextEditorMessages.getBundleForConstructedKeys(), // $NON-NLS-1$
"Editor.ToggleQuickDiffAction.", // $NON-NLS-1$
IAction.AS_CHECK_BOX) {
@Override
public void run() {
toggleQuickDiffRuler();
}
};
action.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICKDIFF_TOGGLE);
setAction(ITextEditorActionConstants.QUICKDIFF_TOGGLE, action);
action = new RevertLineAction(this, false);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICKDIFF_REVERTLINE);
setAction(ITextEditorActionConstants.QUICKDIFF_REVERTLINE, action);
action = new RevertSelectionAction(this, false);
setAction(ITextEditorActionConstants.QUICKDIFF_REVERTSELECTION, action);
action = new RevertBlockAction(this, false);
setAction(ITextEditorActionConstants.QUICKDIFF_REVERTBLOCK, action);
action = new RestoreAction(this, false);
setAction(ITextEditorActionConstants.QUICKDIFF_REVERTDELETION, action);
IAction action2 = new CompositeRevertAction(this, new IAction[] { getAction(ITextEditorActionConstants.QUICKDIFF_REVERTSELECTION), getAction(ITextEditorActionConstants.QUICKDIFF_REVERTBLOCK), getAction(ITextEditorActionConstants.QUICKDIFF_REVERTDELETION), getAction(ITextEditorActionConstants.QUICKDIFF_REVERTLINE) });
action2.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICKDIFF_REVERT);
setAction(ITextEditorActionConstants.QUICKDIFF_REVERT, action2);
action = new // $NON-NLS-1$
ResourceAction(// $NON-NLS-1$
TextEditorMessages.getBundleForConstructedKeys(), // $NON-NLS-1$
"Editor.HideRevisionInformationAction.") {
@Override
public void run() {
if (fLineColumn != null)
fLineColumn.hideRevisionInformation();
}
};
setAction(ITextEditorActionConstants.REVISION_HIDE_INFO, action);
action = new // $NON-NLS-1$
ResourceAction(// $NON-NLS-1$
TextEditorMessages.getBundleForConstructedKeys(), // $NON-NLS-1$
"Editor.CycleRevisionRenderingAction.") {
@Override
public void run() {
final RenderingMode[] modes = { IRevisionRulerColumnExtension.AGE, IRevisionRulerColumnExtension.AUTHOR, IRevisionRulerColumnExtension.AUTHOR_SHADED_BY_AGE };
IPreferenceStore store = EditorsUI.getPreferenceStore();
String current = store.getString(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_RENDERING_MODE);
for (int i = 0; i < modes.length; i++) {
String mode = modes[i].name();
if (mode.equals(current)) {
int nextIndex = (i + 1) % modes.length;
RenderingMode nextMode = modes[nextIndex];
store.setValue(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_RENDERING_MODE, nextMode.name());
}
}
}
};
action.setActionDefinitionId(ITextEditorActionDefinitionIds.REVISION_RENDERING_CYCLE);
setAction(ITextEditorActionConstants.REVISION_RENDERING_CYCLE, action);
// $NON-NLS-1$
action = new BooleanPreferenceToggleAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ToggleRevisionAuthorAction.", IAction.AS_CHECK_BOX, EditorsUI.getPreferenceStore(), AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_AUTHOR);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.REVISION_AUTHOR_TOGGLE);
setAction(ITextEditorActionConstants.REVISION_SHOW_AUTHOR_TOGGLE, action);
// $NON-NLS-1$
action = new BooleanPreferenceToggleAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ToggleRevisionIdAction.", IAction.AS_CHECK_BOX, EditorsUI.getPreferenceStore(), AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_REVISION);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.REVISION_ID_TOGGLE);
setAction(ITextEditorActionConstants.REVISION_SHOW_ID_TOGGLE, action);
final Shell shell;
if (getSourceViewer() != null)
shell = getSourceViewer().getTextWidget().getShell();
else
shell = null;
action = new // $NON-NLS-1$
ResourceAction(// $NON-NLS-1$
TextEditorMessages.getBundleForConstructedKeys(), // $NON-NLS-1$
"Editor.RulerPreferencesAction.") {
@Override
public void run() {
String[] preferencePages = collectRulerMenuPreferencePages();
if (preferencePages.length > 0 && (shell == null || !shell.isDisposed()))
PreferencesUtil.createPreferenceDialogOn(shell, preferencePages[0], preferencePages, null).open();
}
};
setAction(ITextEditorActionConstants.RULER_PREFERENCES, action);
action = new // $NON-NLS-1$
ResourceAction(// $NON-NLS-1$
TextEditorMessages.getBundleForConstructedKeys(), // $NON-NLS-1$
"Editor.ContextPreferencesAction.") {
@Override
public void run() {
String[] preferencePages = collectContextMenuPreferencePages();
if (preferencePages.length > 0 && (shell == null || !shell.isDisposed()))
PreferencesUtil.createPreferenceDialogOn(shell, preferencePages[0], preferencePages, null).open();
}
};
setAction(ITextEditorActionConstants.CONTEXT_PREFERENCES, action);
IAction showWhitespaceCharactersAction = getAction(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS);
if (showWhitespaceCharactersAction instanceof ShowWhitespaceCharactersAction)
((ShowWhitespaceCharactersAction) showWhitespaceCharactersAction).setPreferenceStore(EditorsUI.getPreferenceStore());
setAction(ITextEditorActionConstants.REFRESH, new RefreshEditorAction(this));
markAsPropertyDependentAction(ITextEditorActionConstants.REFRESH, true);
// Override print action to provide additional options
if (getAction(ITextEditorActionConstants.PRINT).isEnabled() && getSourceViewer() instanceof ITextViewerExtension8)
createPrintAction();
action = new // $NON-NLS-1$
ResourceAction(// $NON-NLS-1$
TextEditorMessages.getBundleForConstructedKeys(), // $NON-NLS-1$
"Editor.ShowChangeRulerInformation.", // $NON-NLS-1$
IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
showChangeRulerInformation();
}
};
action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_CHANGE_RULER_INFORMATION_ID);
setAction(ITextEditorActionConstants.SHOW_CHANGE_RULER_INFORMATION, action);
action = new // $NON-NLS-1$
ResourceAction(// $NON-NLS-1$
TextEditorMessages.getBundleForConstructedKeys(), // $NON-NLS-1$
"Editor.ShowRulerAnnotationInformation.", // $NON-NLS-1$
IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
showRulerAnnotationInformation();
}
};
action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_RULER_ANNOTATION_INFORMATION_ID);
setAction(ITextEditorActionConstants.SHOW_RULER_ANNOTATION_INFORMATION, action);
}
Aggregations