mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DumbServiceImpl: cleanup and restore the ability to finish indexing in the same modality state where it was started
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user