check for sudden dumb mode in on-the-fly import (IDEA-154934)
authorpeter <peter@jetbrains.com>
Tue, 19 Apr 2016 12:23:39 +0000 (14:23 +0200)
committerpeter <peter@jetbrains.com>
Tue, 19 Apr 2016 12:41:23 +0000 (14:41 +0200)
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DefaultHighlightInfoProcessor.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowAutoImportPass.java

index 0c3b88741e06d9877f53c2fe5c7b86db1d132d41..10d387268e71684957262137b43529d977dc3b6b 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.ex.MarkupModelEx;
 import com.intellij.openapi.editor.impl.DocumentMarkupModel;
 import com.intellij.openapi.editor.impl.EditorMarkupModelImpl;
 import com.intellij.openapi.editor.markup.MarkupModel;
 import com.intellij.openapi.editor.impl.DocumentMarkupModel;
 import com.intellij.openapi.editor.impl.EditorMarkupModelImpl;
 import com.intellij.openapi.editor.markup.MarkupModel;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.ProperTextRange;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.ProperTextRange;
 import com.intellij.openapi.util.TextRange;
@@ -67,8 +68,10 @@ public class DefaultHighlightInfoProcessor extends HighlightInfoProcessor {
         }
         if (editor != null && !editor.isDisposed()) {
           // usability: show auto import popup as soon as possible
         }
         if (editor != null && !editor.isDisposed()) {
           // usability: show auto import popup as soon as possible
-          new ShowAutoImportPass(project, psiFile, editor).addImports();
-          
+          if (!DumbService.isDumb(project)) {
+            new ShowAutoImportPass(project, psiFile, editor).addImports();
+          }
+
           DaemonListeners.repaintErrorStripeRenderer(editor, project);
         }
       }
           DaemonListeners.repaintErrorStripeRenderer(editor, project);
         }
       }
index 84588369bd9a2b5d67c5eaeb77757bbbc6e00398..5db40f31ab5f2970188ce0a7699d0a25ef8cdd70 100644 (file)
@@ -78,8 +78,6 @@ public class ShowAutoImportPass extends TextEditorHighlightingPass {
   }
 
   public void addImports() {
   }
 
   public void addImports() {
-    if (!isValid()) return;
-
     Application application = ApplicationManager.getApplication();
     application.assertIsDispatchThread();
     if (!application.isUnitTestMode() && !myEditor.getContentComponent().hasFocus()) return;
     Application application = ApplicationManager.getApplication();
     application.assertIsDispatchThread();
     if (!application.isUnitTestMode() && !myEditor.getContentComponent().hasFocus()) return;