Example usage for com.intellij.openapi.command.undo UndoManager undo

List of usage examples for com.intellij.openapi.command.undo UndoManager undo

Introduction

In this page you can find the example usage for com.intellij.openapi.command.undo UndoManager undo.

Prototype

public abstract void undo(@Nullable FileEditor editor);

Source Link

Usage

From source file:com.intellij.codeInsight.CodeInsightTestCase.java

License:Apache License

protected void undo() {
    UndoManager undoManager = UndoManager.getInstance(myProject);
    TextEditor textEditor = TextEditorProvider.getInstance().getTextEditor(getEditor());
    undoManager.undo(textEditor);
}

From source file:com.intellij.ide.actions.UndoAction.java

License:Apache License

@Override
protected void perform(FileEditor editor, UndoManager undoManager) {
    undoManager.undo(editor);
}

From source file:com.maddyhome.idea.vim.helper.UndoRedoHelper.java

License:Open Source License

public static boolean undo(@NotNull final DataContext context) {
    final Project project = PlatformDataKeys.PROJECT.getData(context);
    final FileEditor fileEditor = PlatformDataKeys.FILE_EDITOR.getData(context);
    final com.intellij.openapi.command.undo.UndoManager undoManager = com.intellij.openapi.command.undo.UndoManager
            .getInstance(project);//from   w  w w.j  a v  a2s .  c o  m
    if (fileEditor != null && undoManager.isUndoAvailable(fileEditor)) {
        undoManager.undo(fileEditor);
        return true;
    }
    return false;
}