EdtTestUtil.runInEdtAndWait fix for proper user action emulation
changed because `com.intellij.ide.IdeEventQueue` doesn't consider events from `SwingUtilities.invokeAndWait` as user interaction
This commit is contained in:
committed by
Nikolay Krasko
parent
0acfce55a8
commit
7758875955
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.test.testFramework
|
package org.jetbrains.kotlin.test.testFramework
|
||||||
|
|
||||||
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import org.jetbrains.annotations.TestOnly
|
import org.jetbrains.annotations.TestOnly
|
||||||
import java.lang.reflect.InvocationTargetException
|
import java.lang.reflect.InvocationTargetException
|
||||||
import javax.swing.SwingUtilities
|
import javax.swing.SwingUtilities
|
||||||
@@ -39,7 +40,11 @@ fun runInEdtAndWait(runnable: () -> Unit) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
SwingUtilities.invokeAndWait(runnable)
|
val application = ApplicationManager.getApplication()
|
||||||
|
if (application != null)
|
||||||
|
application.invokeAndWait(runnable)
|
||||||
|
else
|
||||||
|
SwingUtilities.invokeAndWait(runnable)
|
||||||
}
|
}
|
||||||
catch (e: InvocationTargetException) {
|
catch (e: InvocationTargetException) {
|
||||||
throw e.cause ?: e
|
throw e.cause ?: e
|
||||||
|
|||||||
Reference in New Issue
Block a user