From fc71870d63508c5ad35b3da705369fb81abf02c9 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 10 Nov 2016 15:34:41 +0300 Subject: [PATCH] make isInNonCancelableSection() an instance method to open possibilities for optimisations; test added --- .../openapi/progress/ProgressManager.java | 30 +++++--------- .../progress/impl/CoreProgressManager.java | 39 ++++++++++++++++--- .../project/impl/ProjectManagerImpl.java | 2 +- .../progress/impl/ProgressIndicatorTest.java | 26 +++++++++++++ 4 files changed, 70 insertions(+), 27 deletions(-) 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 7087774fc791..1f4aaf3c80c3 100644 --- a/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java +++ b/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java @@ -141,9 +141,9 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { @Nullable JComponent parentComponent); /** - * Runs a specified process in a background thread and shows a progress dialog, which can be made non-modal by pressing - * background button. Upon successful termination of the process a successRunnable will be called in Swing UI thread and - * canceledRunnable will be called if terminated on behalf of the user by pressing either cancel button, while running in + * Runs a specified {@code process} in a background thread and shows a progress dialog, which can be made non-modal by pressing + * background button. Upon successful termination of the process a {@code successRunnable} will be called in Swing UI thread and + * {@code canceledRunnable} will be called if terminated on behalf of the user by pressing either cancel button, while running in * a modal state or stop button if running in background. * * @param project the project in the context of which the operation is executed. @@ -159,9 +159,9 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { @Nullable Runnable successRunnable, @Nullable Runnable canceledRunnable); /** - * Runs a specified process in a background thread and shows a progress dialog, which can be made non-modal by pressing - * background button. Upon successful termination of the process a successRunnable will be called in Swing UI thread and - * canceledRunnable will be called if terminated on behalf of the user by pressing either cancel button, while running in + * Runs a specified {@code process} in a background thread and shows a progress dialog, which can be made non-modal by pressing + * background button. Upon successful termination of the process a {@code successRunnable} will be called in Swing UI thread and + * {@code canceledRunnable} will be called if terminated on behalf of the user by pressing either cancel button, while running in * a modal state or stop button if running in background. * * @param project the project in the context of which the operation is executed. @@ -180,7 +180,7 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { @NotNull PerformInBackgroundOption option); /** - * Runs a specified task in either background/foreground thread and shows a progress dialog. + * Runs a specified {@code task} in either background/foreground thread and shows a progress dialog. * * @param task task to run (either {@link Task.Modal} or {@link Task.Backgroundable}). */ @@ -226,7 +226,7 @@ public abstract class ProgressManager extends ProgressIndicatorProvider { * 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). - * It returns true if action was executed successfully. It returns false if the action was not + * It returns {@code true} if action was executed successfully. It returns {@code false} if the action was not * executed successfully, i.e. if: *