LightQuickFixTestCase: run intentions in a transaction
[idea/community.git] / java / testFramework / src / com / intellij / codeInsight / daemon / quickFix / LightQuickFixTestCase.java
index aa260c135230c0987bd54c926da77ed0099f767d..5cd855e497871eeb2a7fb5f608c553871458be52 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInsight.daemon.impl.HighlightInfo;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler;
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.WriteAction;
 import com.intellij.openapi.command.CommandProcessor;
 import com.intellij.openapi.editor.Editor;
@@ -143,7 +144,8 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase
     ReadonlyStatusHandlerImpl handler = (ReadonlyStatusHandlerImpl)ReadonlyStatusHandler.getInstance(file.getProject());
     handler.setClearReadOnlyInTests(true);
     try {
-      ShowIntentionActionsHandler.chooseActionAndInvoke(file, getEditor(), action, action.getText());
+      ApplicationManager.getApplication().invokeLater(() ->
+        ShowIntentionActionsHandler.chooseActionAndInvoke(file, getEditor(), action, action.getText()));
       UIUtil.dispatchAllInvocationEvents();
     }
     finally {