reuse PerformInBackgroundOption#DEAF and PerformInBackgroundOption#ALWAYS_BACKGROUND

GitOrigin-RevId: 46407bff6cb8a2d0aed3457be41ba2f7e1791fa2
This commit is contained in:
Daniil Ovchinnikov
2021-04-06 16:43:11 +00:00
committed by intellij-monorepo-bot
parent f84b484910
commit 4a7fd61c4e
4 changed files with 9 additions and 32 deletions
@@ -228,7 +228,7 @@ public class GlobalInspectionContextBase extends UserDataHolderBase implements G
@NotNull
protected PerformInBackgroundOption createOption() {
return () -> true;
return PerformInBackgroundOption.ALWAYS_BACKGROUND;
}
protected void notifyInspectionsFinished(@NotNull AnalysisScope scope) {
@@ -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.openapi.editor.actions;
import com.intellij.ide.IdeBundle;
@@ -12,6 +12,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.PerformInBackgroundOption;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
@@ -77,7 +78,7 @@ public class RemoveBomAction extends AnAction implements DumbAware {
List<VirtualFile> filesToProcess = getFilesWithBom(files);
if (filesToProcess.isEmpty()) return;
List<VirtualFile> filesUnableToProcess = new ArrayList<>();
new Task.Backgroundable(getEventProject(e), IdeBundle.message("removing.BOM"), true, () -> false) {
new Task.Backgroundable(getEventProject(e), IdeBundle.message("removing.BOM"), true, PerformInBackgroundOption.DEAF) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
indicator.setIndeterminate(false);
@@ -119,12 +119,8 @@ public final class ExportTestResultsAction extends DumbAwareAction {
return;
}
ProgressManager.getInstance().run(
new Task.Backgroundable(project, ExecutionBundle.message("export.test.results.task.name"), false, new PerformInBackgroundOption() {
@Override
public boolean shouldStartInBackground() {
return true;
}
}) {
new Task.Backgroundable(project, ExecutionBundle.message("export.test.results.task.name"), false,
PerformInBackgroundOption.ALWAYS_BACKGROUND) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
indicator.setIndeterminate(true);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// 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.openapi.vcs.changes;
import com.intellij.openapi.progress.PerformInBackgroundOption;
@@ -23,15 +9,9 @@ import org.jetbrains.annotations.ApiStatus;
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2021.3")
public class BackgroundFromStartOption implements PerformInBackgroundOption {
private final static BackgroundFromStartOption ourInstance = new BackgroundFromStartOption();
public class BackgroundFromStartOption {
public static PerformInBackgroundOption getInstance() {
return ourInstance;
}
@Override
public boolean shouldStartInBackground() {
return true;
return PerformInBackgroundOption.ALWAYS_BACKGROUND;
}
}