mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Notify message bus only if indicator is ProgressWindow
GitOrigin-RevId: ad11dd445d49f94ae18295b43fff5cfc4171a6d6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
23ff024378
commit
eff2bc98cf
@@ -5,8 +5,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface ProgressManagerListener {
|
||||
void beforeExecuteUnderProgress(@NotNull Runnable process, ProgressIndicator progress);
|
||||
void afterExecuteUnderProgress(@NotNull Runnable process, ProgressIndicator progress);
|
||||
void onTaskRunnableCreated(@NotNull Task task, @NotNull ProgressIndicator indicator, @Nullable Runnable continuation);
|
||||
void onTaskFinished(@NotNull Task task, boolean canceled, @Nullable Throwable error);
|
||||
}
|
||||
|
||||
@@ -422,12 +422,7 @@ public class CoreProgressManager extends ProgressManager implements Disposable {
|
||||
protected TaskRunnable createTaskRunnable(@NotNull Task task,
|
||||
@NotNull ProgressIndicator indicator,
|
||||
@Nullable Runnable continuation) {
|
||||
try {
|
||||
return new TaskRunnable(task, indicator, continuation);
|
||||
} finally {
|
||||
ApplicationManager.getApplication().getMessageBus().syncPublisher(TOPIC)
|
||||
.onTaskRunnableCreated(task, indicator, continuation);
|
||||
}
|
||||
return new TaskRunnable(task, indicator, continuation);
|
||||
}
|
||||
|
||||
private static class IndicatorDisposable implements Disposable {
|
||||
@@ -585,8 +580,6 @@ public class CoreProgressManager extends ProgressManager implements Disposable {
|
||||
}
|
||||
finally {
|
||||
task.onFinished();
|
||||
ApplicationManager.getApplication().getMessageBus().syncPublisher(TOPIC)
|
||||
.onTaskFinished(task, canceled, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,8 +600,6 @@ public class CoreProgressManager extends ProgressManager implements Disposable {
|
||||
if (progress == null) myUnsafeProgressCount.incrementAndGet();
|
||||
|
||||
try {
|
||||
ApplicationManager.getApplication().getMessageBus().syncPublisher(TOPIC)
|
||||
.beforeExecuteUnderProgress(process, progress);
|
||||
ProgressIndicator oldIndicator = null;
|
||||
boolean set = progress != null && progress != (oldIndicator = getProgressIndicator());
|
||||
if (set) {
|
||||
@@ -628,8 +619,6 @@ public class CoreProgressManager extends ProgressManager implements Disposable {
|
||||
}
|
||||
finally {
|
||||
if (progress == null) myUnsafeProgressCount.decrementAndGet();
|
||||
ApplicationManager.getApplication().getMessageBus().syncPublisher(TOPIC)
|
||||
.afterExecuteUnderProgress(process, progress);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+25
@@ -8,6 +8,7 @@ import com.intellij.openapi.progress.*;
|
||||
import com.intellij.openapi.progress.util.PingProgress;
|
||||
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
|
||||
import com.intellij.openapi.progress.util.ProgressIndicatorUtils;
|
||||
import com.intellij.openapi.progress.util.ProgressWindow;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.UserDataHolder;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
@@ -103,6 +104,20 @@ public class ProgressManagerImpl extends CoreProgressManager implements Disposab
|
||||
SystemNotifications.getInstance().notify(info.getNotificationName(), info.getNotificationTitle(), info.getNotificationText());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull TaskRunnable createTaskRunnable(@NotNull Task task,
|
||||
@NotNull ProgressIndicator indicator,
|
||||
@Nullable Runnable continuation) {
|
||||
try {
|
||||
return super.createTaskRunnable(task, indicator, continuation);
|
||||
} finally {
|
||||
if (indicator instanceof ProgressWindow) {
|
||||
ApplicationManager.getApplication().getMessageBus().syncPublisher(TOPIC)
|
||||
.onTaskRunnableCreated(task, indicator, continuation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Future<?> runProcessWithProgressAsynchronously(@NotNull Task.Backgroundable task) {
|
||||
@@ -130,6 +145,16 @@ public class ProgressManagerImpl extends CoreProgressManager implements Disposab
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finishTask(@NotNull Task task, boolean canceled, @Nullable Throwable error) {
|
||||
try {
|
||||
super.finishTask(task, canceled, error);
|
||||
} finally {
|
||||
ApplicationManager.getApplication().getMessageBus().syncPublisher(TOPIC)
|
||||
.onTaskFinished(task, canceled, error);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runInReadActionWithWriteActionPriority(@NotNull Runnable action, @Nullable ProgressIndicator indicator) {
|
||||
return ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(action, indicator);
|
||||
|
||||
Reference in New Issue
Block a user