EA-33195 - assert: DocumentUndoProvider$MyEditorDocumentListener.documentChanged...
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Wed, 25 Jan 2012 15:36:02 +0000 (19:36 +0400)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Wed, 25 Jan 2012 15:49:09 +0000 (19:49 +0400)
java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java

index de3dd9049601927db39860129d6ee657b8f33632..5a429287899606d3858c578ef68662e77f6d09e8 100644 (file)
@@ -51,6 +51,7 @@ import com.intellij.lang.Language;
 import com.intellij.lang.annotation.HighlightSeverity;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.CommandProcessor;
+import com.intellij.openapi.command.undo.UndoManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
@@ -200,6 +201,9 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
       @Override
       public void run() {
         if (file.getProject().isDisposed() || editor.isDisposed() || editor.getDocument().getModificationStamp() != stamp) return;
+        //no need to optimize imports on the fly during undo/redo
+        final UndoManager undoManager = UndoManager.getInstance(editor.getProject());
+        if (undoManager.isUndoInProgress() || undoManager.isRedoInProgress()) return;
         PsiDocumentManager.getInstance(file.getProject()).commitAllDocuments();
         String beforeText = file.getText();
         final long oldStamp = editor.getDocument().getModificationStamp();