From 05af40a70714a142ab384499a2d9ea63de00d44c Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Tue, 6 Apr 2021 19:30:06 +0200 Subject: [PATCH] remove unnecessary overrides of `Task$Backgroundable#shouldStartInBackground` GitOrigin-RevId: c730cc278a7dd3856fb7181ffb0442a6274d4aa6 --- .../templates/SaveProjectAsTemplateAction.java | 14 ++++++-------- .../util/download/impl/FileDownloaderImpl.java | 6 +----- .../nodes/HeadlessValueEvaluationCallback.java | 8 ++------ .../ant/config/execution/ExecutionHandler.java | 7 +------ 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java b/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java index 21de7b6d4d69..69ee8c2cfc8c 100644 --- a/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java +++ b/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.platform.templates; import com.intellij.CommonBundle; @@ -22,7 +22,10 @@ import com.intellij.openapi.components.PathMacroManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.module.Module; -import com.intellij.openapi.progress.*; +import com.intellij.openapi.progress.ProcessCanceledException; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.ProgressManager; +import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ContentIterator; @@ -86,7 +89,7 @@ public class SaveProjectAsTemplateAction extends AnAction implements DumbAware { FileDocumentManager.getInstance().saveAllDocuments(); - ProgressManager.getInstance().run(new Task.Backgroundable(project, LangBundle.message("progress.title.saving.project.as.template"), true, PerformInBackgroundOption.DEAF) { + ProgressManager.getInstance().run(new Task.Backgroundable(project, LangBundle.message("progress.title.saving.project.as.template"), true) { @Override public void run(@NotNull final ProgressIndicator indicator) { saveProject(project, file, moduleToSave, description, dialog.isReplaceParameters(), indicator, shouldEscape()); @@ -109,11 +112,6 @@ public class SaveProjectAsTemplateAction extends AnAction implements DumbAware { notification.notify(getProject()); } - @Override - public boolean shouldStartInBackground() { - return true; - } - @Override public void onCancel() { PathKt.delete(file); diff --git a/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java b/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java index 760a2deac805..1e9f94d9c6ef 100644 --- a/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java +++ b/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.download.impl; import com.intellij.ide.IdeBundle; @@ -155,10 +155,6 @@ class FileDownloaderImpl implements FileDownloader { CompletableFuture>> result = new CompletableFuture<>(); ProgressManager.getInstance().run(new Task.Backgroundable(project, myDialogTitle, true) { - @Override - public boolean shouldStartInBackground() { - return true; - } @Override public void run(@NotNull ProgressIndicator indicator) { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/HeadlessValueEvaluationCallback.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/HeadlessValueEvaluationCallback.java index aee140c2cac2..225dab3430af 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/HeadlessValueEvaluationCallback.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/HeadlessValueEvaluationCallback.java @@ -2,6 +2,7 @@ package com.intellij.xdebugger.impl.ui.tree.nodes; import com.intellij.notification.NotificationType; +import com.intellij.openapi.progress.PerformInBackgroundOption; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; @@ -83,7 +84,7 @@ public class HeadlessValueEvaluationCallback implements XFullValueEvaluator.XFul return; } - new Task.Backgroundable(myNode.getTree().getProject(), XDebuggerBundle.message("load.value.task.text")) { + new Task.Backgroundable(myNode.getTree().getProject(), XDebuggerBundle.message("load.value.task.text"), true, PerformInBackgroundOption.DEAF) { @Override public void run(@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); @@ -95,11 +96,6 @@ public class HeadlessValueEvaluationCallback implements XFullValueEvaluator.XFul } } - @Override - public boolean shouldStartInBackground() { - return false; - } - @Override public void onCancel() { myCanceled = true; diff --git a/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java b/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java index 64c3a2b8b17d..9bc72ed73ffd 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.lang.ant.config.execution; import com.intellij.execution.CantRunException; @@ -147,11 +147,6 @@ public final class ExecutionHandler { final FutureResult future = new FutureResult<>(); new Task.Backgroundable(buildFile.getProject(), AntBundle.message("ant.build.progress.dialog.title"), true) { - @Override - public boolean shouldStartInBackground() { - return true; - } - @Override public void onCancel() { listenerWrapper.buildFinished(AntBuildListener.ABORTED, 0);