do not invoke later in tests
authorAlexey Kudravtsev <cdr@intellij.com>
Mon, 12 Jul 2010 12:59:28 +0000 (16:59 +0400)
committerAlexey Kudravtsev <cdr@intellij.com>
Tue, 13 Jul 2010 07:57:39 +0000 (11:57 +0400)
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java

index a477b2430515d51a44ed7c81490776c59fa213a1..afc877a3f6ddcdef849aef5adf6212b9ecc66a0f 100644 (file)
@@ -19,6 +19,7 @@ package com.intellij.codeInsight.daemon.impl;
 import com.intellij.codeInsight.daemon.ChangeLocalityDetector;
 import com.intellij.codeInspection.SuppressionUtil;
 import com.intellij.openapi.Disposable;
+import com.intellij.openapi.application.Application;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.editor.Document;
@@ -166,8 +167,9 @@ public class PsiChangeHandler extends PsiTreeChangeAdapter implements Disposable
 
   private void updateByChange(PsiElement child, final boolean whitespaceOptimizationAllowed) {
     final Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor();
-    if (editor != null) {
-      ApplicationManager.getApplication().invokeLater(new Runnable() {
+    Application application = ApplicationManager.getApplication();
+    if (editor != null && !application.isUnitTestMode()) {
+      application.invokeLater(new Runnable() {
         public void run() {
           if (myProject.isDisposed()) return;
           EditorMarkupModel markupModel = (EditorMarkupModel)editor.getMarkupModel();