mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
try to finish dumb mode in the same context as it started
This commit is contained in:
@@ -60,6 +60,7 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica
|
||||
private static Throwable ourForcedTrace;
|
||||
private volatile boolean myDumb = false;
|
||||
private volatile Throwable myDumbStart;
|
||||
private volatile TransactionId myDumbStartTransaction;
|
||||
private boolean myUpdateFinishedQueued;
|
||||
private final DumbModeListener myPublisher;
|
||||
private long myModificationCount;
|
||||
@@ -158,6 +159,8 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica
|
||||
|
||||
@Override
|
||||
public void queueTask(@NotNull final DumbModeTask task) {
|
||||
TransactionId contextTransaction = TransactionGuard.getInstance().getContextTransaction();
|
||||
|
||||
final Throwable trace = ourForcedTrace != null ? ourForcedTrace : new Throwable(); // please report exceptions here to peter
|
||||
final DumbModePermission schedulerPermission = getExplicitPermission();
|
||||
if (LOG.isDebugEnabled()) LOG.debug("Scheduling task " + task, trace);
|
||||
@@ -218,6 +221,7 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica
|
||||
myDumb = true;
|
||||
}
|
||||
myDumbStart = trace;
|
||||
myDumbStartTransaction = contextTransaction;
|
||||
myModificationCount++;
|
||||
if (!myUpdateFinishedQueued) {
|
||||
try {
|
||||
@@ -539,7 +543,7 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica
|
||||
return result.get();
|
||||
}
|
||||
|
||||
private static void invokeAndWaitIfNeeded(Runnable runnable) {
|
||||
private void invokeAndWaitIfNeeded(Runnable runnable) {
|
||||
Application app = ApplicationManager.getApplication();
|
||||
if (app.isDispatchThread()) {
|
||||
runnable.run();
|
||||
@@ -551,7 +555,7 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica
|
||||
//todo remove invokeLater when transactions are executed in "any" modality state
|
||||
//noinspection SSBasedInspection
|
||||
SwingUtilities.invokeLater(
|
||||
() -> TransactionGuard.submitTransaction(app, () -> {
|
||||
() -> TransactionGuard.getInstance().submitMergeableTransaction(app, myDumbStartTransaction, () -> {
|
||||
try {
|
||||
runnable.run();
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user