diff --git a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java index e22c682b0842..38d371ecce15 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java @@ -293,7 +293,7 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica private void queueUpdateFinished(boolean modal) { if (myUpdateFinishedQueued) return; myUpdateFinishedQueued = true; - TransactionGuard.submitTransaction(myProject, () -> ApplicationManager.getApplication().runWriteAction(() -> updateFinished(modal))); + TransactionGuard.getInstance().submitTransaction(myProject, myDumbStartTransaction, () -> WriteAction.run(() -> updateFinished(modal))); } private void updateFinished(boolean modal) { @@ -516,7 +516,7 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica return result.get(); } - private void invokeAndWaitIfNeeded(Runnable runnable) { + private static void invokeAndWaitIfNeeded(Runnable runnable) { Application app = ApplicationManager.getApplication(); if (app.isDispatchThread()) { runnable.run(); @@ -525,14 +525,13 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica Semaphore semaphore = new Semaphore(); semaphore.down(); - //noinspection SSBasedInspection - SwingUtilities.invokeLater(() -> { + app.invokeLater(() -> { try { runnable.run(); } finally { semaphore.up(); } - }); + }, ModalityState.any()); try { semaphore.waitFor(); }