From eea29c341505b2befd8b1f511bf38e735d194108 Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Fri, 20 Oct 2017 12:57:56 +0300 Subject: [PATCH] IDEA-179753 "Undo" action can be invoked from "Undo" confirmation dialog --- .../com/intellij/ide/actions/UndoRedoAction.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/ide/actions/UndoRedoAction.java b/platform/platform-impl/src/com/intellij/ide/actions/UndoRedoAction.java index e10d66bf232b..b50d6857ccf2 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/UndoRedoAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/UndoRedoAction.java @@ -35,6 +35,8 @@ import javax.swing.*; import java.awt.*; public abstract class UndoRedoAction extends DumbAwareAction { + private static boolean ourInProgress = false;//We should disable both undo and redo while Undo/Redo confirmation dialog is shown + public UndoRedoAction() { setEnabledInModalContext(true); } @@ -43,11 +45,20 @@ public abstract class UndoRedoAction extends DumbAwareAction { DataContext dataContext = e.getDataContext(); FileEditor editor = PlatformDataKeys.FILE_EDITOR.getData(dataContext); UndoManager undoManager = getUndoManager(editor, dataContext); - perform(editor, undoManager); + try { + ourInProgress = true; + perform(editor, undoManager); + } finally { + ourInProgress = false; + } } public void update(AnActionEvent event) { Presentation presentation = event.getPresentation(); + if (ourInProgress) { + presentation.setEnabled(false); + return; + } DataContext dataContext = event.getDataContext(); FileEditor editor = PlatformDataKeys.FILE_EDITOR.getData(dataContext); UndoManager undoManager = getUndoManager(editor, dataContext);