From be49f04479afc47c33526200195b918aa23edc4b Mon Sep 17 00:00:00 2001
From: Daniil Ovchinnikov
+ * This interface and its implementation are effectively obsolete.
+ * More info in the issue and linked issues and
+ * in the Knowledge Base.
+ * It's not marked with {@link ApiStatus.Obsolete} at the moment to avoid excessive highlighting everywhere.
+ * Obsolescence notice
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
An object accompanying a computation, usually in a background thread. It allows displaying process status to the user * ({@link #setText}, {@link #setText2}, {@link #setFraction}, {@link #setIndeterminate}) and * interrupt if the computation is canceled ({@link #checkCanceled()}).
diff --git a/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java b/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java index 0f070e834111..fa34d6ba39b5 100644 --- a/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java +++ b/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java @@ -11,7 +11,12 @@ import com.intellij.openapi.util.NlsContexts.ProgressText; import com.intellij.openapi.util.NlsContexts.ProgressTitle; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.ThrowableComputable; +import com.intellij.platform.util.progress.StepsKt; import com.intellij.util.concurrency.annotations.RequiresBlockingContext; +import kotlin.coroutines.Continuation; +import kotlin.jvm.functions.Function0; +import kotlin.jvm.functions.Function1; +import kotlin.jvm.functions.Function2; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus.Obsolete; import org.jetbrains.annotations.NotNull; @@ -48,19 +53,38 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { public abstract boolean hasUnsafeProgressIndicator(); /** + *+ * See {@link ProgressIndicator} notice. + *
+ * See {@link ProgressIndicator} notice. + * See {@link #runProcess(Runnable, ProgressIndicator)} notice. + *
+ * * Performs the given computation synchronously in calling thread and returns its result, associating this thread with the specified progress indicator. * This means that it'll be returned by {@link ProgressManager#getProgressIndicator()} inside the {@code process}, * and {@link ProgressManager#checkCanceled()} will throw a {@link ProcessCanceledException} if the progress indicator is canceled. @@ -77,6 +101,27 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { return ref.get(); } + /** + *+ * See {@link ProgressIndicator} notice. + *
+ * See {@link ProgressIndicator} notice. + *
+ * See {@link ProgressIndicator} notice. + * See {@link #runProcessWithProgressSynchronously(Runnable, String, boolean, Project)} notice. + *
* Runs the specified operation in a background thread and shows a modal progress dialog in the * main thread while the operation is executing. * If a dialog can't be shown (e.g. under write action or in headless environment), @@ -157,6 +217,12 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { @Nullable Project project) throws E; /** + *+ * See {@link ProgressIndicator} notice. + * See {@link #runProcessWithProgressSynchronously(Runnable, String, boolean, Project)} notice. + *
+ * * Runs the specified operation in a background thread and shows a modal progress dialog in the * main thread while the operation is executing. * If a dialog can't be shown (e.g. under write action or in headless environment), @@ -200,6 +266,16 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { @NotNull PerformInBackgroundOption option); /** + *
+ * See {@link ProgressIndicator} notice.
+ *
+ * Do not use directly!
+ * Use {@link Task#queue()} instead of this method, or migrate the Task to coroutines.
+ * Please find appropriate replacements in the respective Task documentation:
+ * {@link Task.Backgroundable}, {@link Task.Modal}, {@link Task.WithResult}, {@link Task.ConditionalModal}.
+ *
+ * See {@link ProgressIndicator} notice. + * See {@link Task.WithResult} notice. + *
+ * * Runs a specified computation with a modal progress dialog. */ @Obsolete @@ -222,6 +304,13 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { return task.getResult(); } + /** + *+ * See {@link ProgressIndicator} notice. + * See {@link ProgressManager#run(Task)} notice. + *
+ */ @Obsolete public abstract void runProcessWithProgressAsynchronously(@NotNull Task.Backgroundable task, @NotNull ProgressIndicator progressIndicator); @@ -245,6 +334,12 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { } /** + *+ * See {@link ProgressIndicator} notice. + * See {@link #runProcess(Runnable, ProgressIndicator)} notice. + *
+ * * @param progress an indicator to use, {@code null} means reuse current progress * The methods {@link ProgressIndicator#start()} or {@link ProgressIndicator#stop()} are not called because it's assumed the {@code progress} is already running. */ @@ -264,6 +359,12 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { } /** + *+ * See {@link ProgressIndicator} notice. + * Use {@link com.intellij.openapi.application.ReadAction#computeCancellable} instead. + *
+ * * This method attempts to run provided action synchronously in a read action, so that, if possible, it wouldn't impact any pending, * executing or future write actions (for this to work effectively the action should invoke {@link ProgressManager#checkCanceled()} or * {@link ProgressIndicator#checkCanceled()} often enough). diff --git a/platform/core-api/src/com/intellij/openapi/progress/Task.java b/platform/core-api/src/com/intellij/openapi/progress/Task.java index 4e20a6bd4002..7a479ccff0d0 100644 --- a/platform/core-api/src/com/intellij/openapi/progress/Task.java +++ b/platform/core-api/src/com/intellij/openapi/progress/Task.java @@ -15,6 +15,8 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ExceptionUtil; import com.intellij.util.ObjectUtils; import com.intellij.util.concurrency.annotations.RequiresBlockingContext; +import kotlin.coroutines.Continuation; +import kotlin.jvm.functions.Function2; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus.Obsolete; import org.jetbrains.annotations.NotNull; @@ -24,6 +26,7 @@ import javax.swing.*; /** *+ * See {@link ProgressIndicator} notice. + * Use {@link com.intellij.platform.ide.progress.TasksKt#withBackgroundProgress}. + *
*/ @Obsolete public abstract static class Backgroundable extends Task implements PerformInBackgroundOption { @@ -257,8 +264,14 @@ public abstract class Task implements TaskInfo, Progressive { } /** - * @see com.intellij.openapi.progress.TasksKt#withModalProgress - * @see com.intellij.openapi.progress.TasksKt#runWithModalProgressBlocking + *+ * See {@link ProgressIndicator} notice. + *
+ * See {@link ProgressIndicator} notice. + *
+ * See {@link ProgressIndicator} notice. + *