mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
[tests] fixed: use expire condition instead isDisposed check for EDT tasks with project
GitOrigin-RevId: f69fbfbee573ed15ac0762aab12815c969cfe6ad
This commit is contained in:
committed by
intellij-monorepo-bot
parent
98141e6ee3
commit
97faa11ac5
@@ -5,8 +5,10 @@ import com.intellij.openapi.components.ComponentManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @deprecated Use instead invokeLater with expire condition or use coroutines with component scope.
|
||||
* @author Vladislav.Soroka
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public abstract class DisposeAwareProjectChange implements Runnable {
|
||||
private final ComponentManager myComponentManager;
|
||||
|
||||
|
||||
@@ -167,24 +167,23 @@ public final class ProjectDataManagerImpl implements ProjectDataManager {
|
||||
}
|
||||
|
||||
private static void runFinalTasks(@NotNull Project project, boolean synchronous, List<? extends Runnable> tasks) {
|
||||
Runnable runnable = new DisposeAwareProjectChange(project) {
|
||||
@Override
|
||||
public void execute() {
|
||||
for (Runnable task : ContainerUtil.reverse(tasks)) {
|
||||
task.run();
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
for (Runnable task : ContainerUtil.reverse(tasks)) {
|
||||
task.run();
|
||||
}
|
||||
};
|
||||
if (synchronous) {
|
||||
try {
|
||||
runnable.run();
|
||||
if (!project.isDisposed()) {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.warn(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ApplicationManager.getApplication().invokeLater(runnable);
|
||||
ApplicationManager.getApplication().invokeLater(runnable, project.getDisposed());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user