public class CoreProgressManager extends ProgressManager implements Disposable
| Modifier and Type | Class and Description |
|---|---|
protected static class |
CoreProgressManager.TaskContainer |
protected static class |
CoreProgressManager.TaskRunnable
Deprecated.
|
Disposable.Parent| Modifier and Type | Field and Description |
|---|---|
static boolean |
ENABLED |
| Constructor and Description |
|---|
CoreProgressManager() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertUnderProgress(ProgressIndicator indicator) |
<T,E extends java.lang.Exception> |
computeInNonCancelableSection(ThrowableComputable<T,E> computable)
Runs the specified operation and return its result in non-cancellable manner synchronously on the same thread were it was called.
|
<T,E extends java.lang.Throwable> |
computePrioritized(ThrowableComputable<T,E> computable)
Performs the given computation while giving more priority to the current thread
(by forcing all other non-prioritized threads to sleep a bit whenever they call
ProgressManager.checkCanceled(). |
protected com.intellij.openapi.progress.impl.CoreProgressManager.CheckCanceledHook |
createCheckCanceledHook() |
protected CoreProgressManager.TaskRunnable |
createTaskRunnable(Task task,
ProgressIndicator indicator,
java.lang.Runnable continuation)
Deprecated.
|
void |
dispose()
Usually not invoked directly, see class javadoc.
|
protected void |
doCheckCanceled() |
void |
executeNonCancelableSection(java.lang.Runnable runnable)
Runs the specified operation in non-cancellable manner synchronously on the same thread were it was called.
|
void |
executeProcessUnderProgress(java.lang.Runnable process,
ProgressIndicator progress) |
protected void |
finishTask(Task task,
boolean canceled,
java.lang.Throwable error) |
static ModalityState |
getCurrentThreadProgressModality() |
ProgressIndicator |
getProgressIndicator() |
boolean |
hasModalProgressIndicator() |
boolean |
hasProgressIndicator() |
boolean |
hasUnsafeProgressIndicator() |
protected void |
indicatorCanceled(ProgressIndicator indicator) |
static boolean |
isCanceledThread(java.lang.Thread thread) |
boolean |
isInNonCancelableSection() |
boolean |
isPrioritizedThread(java.lang.Thread from) |
protected void |
prioritizingFinished() |
protected void |
prioritizingStarted() |
void |
restorePrioritizing() |
void |
run(Task task)
Runs a specified
task in either background/foreground thread and shows a progress dialog. |
static boolean |
runCheckCanceledHooks(ProgressIndicator indicator) |
boolean |
runInReadActionWithWriteActionPriority(java.lang.Runnable action,
ProgressIndicator indicator)
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
ProgressManager.checkCanceled() or
ProgressIndicator.checkCanceled() often enough). |
void |
runProcess(java.lang.Runnable process,
ProgressIndicator progress)
Runs the given process synchronously in calling thread, associating this thread with the specified progress indicator.
|
protected java.util.concurrent.Future<?> |
runProcessWithProgressAsync(Task.Backgroundable task,
java.util.concurrent.CompletableFuture<? extends ProgressIndicator> progressIndicator,
java.lang.Runnable continuation,
com.intellij.openapi.progress.impl.CoreProgressManager.IndicatorDisposable indicatorDisposable,
ModalityState modalityState) |
void |
runProcessWithProgressAsynchronously(Project project,
java.lang.String progressTitle,
java.lang.Runnable process,
java.lang.Runnable successRunnable,
java.lang.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. |
void |
runProcessWithProgressAsynchronously(Project project,
java.lang.String progressTitle,
java.lang.Runnable process,
java.lang.Runnable successRunnable,
java.lang.Runnable canceledRunnable,
PerformInBackgroundOption option)
Runs a specified
process in a background thread and shows a progress dialog, which can be made non-modal by pressing
background button. |
java.util.concurrent.Future<?> |
runProcessWithProgressAsynchronously(Task.Backgroundable task) |
void |
runProcessWithProgressAsynchronously(Task.Backgroundable task,
ProgressIndicator progressIndicator) |
java.util.concurrent.Future<?> |
runProcessWithProgressAsynchronously(Task.Backgroundable task,
ProgressIndicator progressIndicator,
java.lang.Runnable continuation) |
java.util.concurrent.Future<?> |
runProcessWithProgressAsynchronously(Task.Backgroundable task,
ProgressIndicator progressIndicator,
java.lang.Runnable continuation,
ModalityState modalityState) |
void |
runProcessWithProgressInCurrentThread(Task task,
ProgressIndicator progressIndicator,
ModalityState modalityState) |
boolean |
runProcessWithProgressSynchronously(java.lang.Runnable process,
java.lang.String progressTitle,
boolean canBeCanceled,
Project project)
Runs the specified operation in a background thread and shows a modal progress dialog in the
main thread while the operation is executing.
|
boolean |
runProcessWithProgressSynchronously(java.lang.Runnable process,
java.lang.String progressTitle,
boolean canBeCanceled,
Project project,
javax.swing.JComponent parentComponent)
Runs the specified operation in a background thread and shows a modal progress dialog in the
main thread while the operation is executing.
|
boolean |
runProcessWithProgressSynchronously(Task task,
javax.swing.JComponent parentComponent) |
<T,E extends java.lang.Exception> |
runProcessWithProgressSynchronously(ThrowableComputable<T,E> process,
java.lang.String progressTitle,
boolean canBeCanceled,
Project project)
Runs the specified operation in a background thread and shows a modal progress dialog in the
main thread while the operation is executing.
|
protected boolean |
sleepIfNeededToGivePriorityToAnotherThread() |
void |
suppressPrioritizing() |
assertNotCircular, canceled, checkCanceled, getInstance, progress, progress, progress2, run, runProcessgetGlobalProgressIndicator, startNonCancelableSectionIfSupportedpublic void dispose()
Disposabledispose in interface Disposablepublic static boolean runCheckCanceledHooks(ProgressIndicator indicator)
protected void doCheckCanceled()
throws ProcessCanceledException
doCheckCanceled in class ProgressIndicatorProviderProcessCanceledExceptionpublic boolean hasProgressIndicator()
hasProgressIndicator in class ProgressManagerpublic boolean hasUnsafeProgressIndicator()
hasUnsafeProgressIndicator in class ProgressManagerpublic boolean hasModalProgressIndicator()
hasModalProgressIndicator in class ProgressManagerpublic void runProcess(java.lang.Runnable process,
ProgressIndicator progress)
ProgressManagerProgressManager.getProgressIndicator() inside the process,
and ProgressManager.checkCanceled() will throw a ProcessCanceledException if the progress indicator is canceled.runProcess in class ProgressManagerprogress - an indicator to use, null means reuse current progresspublic void executeNonCancelableSection(java.lang.Runnable runnable)
ProgressManagerexecuteNonCancelableSection in class ProgressManagerrunnable - the operation to executeProgressManager.computeInNonCancelableSection(ThrowableComputable)public <T,E extends java.lang.Exception> T computeInNonCancelableSection(ThrowableComputable<T,E> computable) throws E extends java.lang.Exception
ProgressManagercomputeInNonCancelableSection in class ProgressManagercomputable - the operation to executeE extends java.lang.ExceptionProgressManager.executeNonCancelableSection(Runnable)public boolean runProcessWithProgressSynchronously(java.lang.Runnable process,
java.lang.String progressTitle,
boolean canBeCanceled,
Project project)
ProgressManagerrunProcessWithProgressSynchronously in class ProgressManagerprocess - the operation to execute.progressTitle - the title of the progress window.canBeCanceled - whether "Cancel" button is shown on the progress window.project - the project in the context of which the operation is executed.public <T,E extends java.lang.Exception> T runProcessWithProgressSynchronously(ThrowableComputable<T,E> process, java.lang.String progressTitle, boolean canBeCanceled, Project project) throws E extends java.lang.Exception
ProgressManagerrunProcessWithProgressSynchronously in class ProgressManagerprocess - the operation to execute.progressTitle - the title of the progress window.canBeCanceled - whether "Cancel" button is shown on the progress window.project - the project in the context of which the operation is executed.E - exception thrown by processE extends java.lang.Exceptionpublic boolean runProcessWithProgressSynchronously(java.lang.Runnable process,
java.lang.String progressTitle,
boolean canBeCanceled,
Project project,
javax.swing.JComponent parentComponent)
ProgressManagerrunProcessWithProgressSynchronously in class ProgressManagerprocess - the operation to execute.progressTitle - the title of the progress window.canBeCanceled - whether "Cancel" button is shown on the progress window.project - the project in the context of which the operation is executed.parentComponent - the component which will be used to calculate the progress window ancestorpublic void runProcessWithProgressAsynchronously(Project project, java.lang.String progressTitle, java.lang.Runnable process, java.lang.Runnable successRunnable, java.lang.Runnable canceledRunnable)
ProgressManagerprocess 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
a modal state or stop button if running in background.runProcessWithProgressAsynchronously in class ProgressManagerproject - the project in the context of which the operation is executed.progressTitle - the title of the progress window.process - the operation to execute.successRunnable - a callback to be called in Swing UI thread upon normal termination of the process.canceledRunnable - a callback to be called in Swing UI thread if the process have been canceled by the user.public void runProcessWithProgressAsynchronously(Project project, java.lang.String progressTitle, java.lang.Runnable process, java.lang.Runnable successRunnable, java.lang.Runnable canceledRunnable, PerformInBackgroundOption option)
ProgressManagerprocess 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
a modal state or stop button if running in background.runProcessWithProgressAsynchronously in class ProgressManagerproject - the project in the context of which the operation is executed.progressTitle - the title of the progress window.process - the operation to execute.successRunnable - a callback to be called in Swing UI thread upon normal termination of the process.canceledRunnable - a callback to be called in Swing UI thread if the process have been canceled by the user.option - progress indicator behavior controller.public void run(Task task)
ProgressManagertask in either background/foreground thread and shows a progress dialog.run in class ProgressManagertask - task to run (either Task.Modal or Task.Backgroundable).public java.util.concurrent.Future<?> runProcessWithProgressAsynchronously(Task.Backgroundable task)
public java.util.concurrent.Future<?> runProcessWithProgressAsynchronously(Task.Backgroundable task, ProgressIndicator progressIndicator, java.lang.Runnable continuation)
@Deprecated protected CoreProgressManager.TaskRunnable createTaskRunnable(Task task, ProgressIndicator indicator, java.lang.Runnable continuation)
public java.util.concurrent.Future<?> runProcessWithProgressAsynchronously(Task.Backgroundable task, ProgressIndicator progressIndicator, java.lang.Runnable continuation, ModalityState modalityState)
protected java.util.concurrent.Future<?> runProcessWithProgressAsync(Task.Backgroundable task, java.util.concurrent.CompletableFuture<? extends ProgressIndicator> progressIndicator, java.lang.Runnable continuation, com.intellij.openapi.progress.impl.CoreProgressManager.IndicatorDisposable indicatorDisposable, ModalityState modalityState)
public boolean runProcessWithProgressSynchronously(Task task, javax.swing.JComponent parentComponent)
public void runProcessWithProgressInCurrentThread(Task task, ProgressIndicator progressIndicator, ModalityState modalityState)
protected void finishTask(Task task, boolean canceled, java.lang.Throwable error)
public void runProcessWithProgressAsynchronously(Task.Backgroundable task, ProgressIndicator progressIndicator)
runProcessWithProgressAsynchronously in class ProgressManagerpublic ProgressIndicator getProgressIndicator()
getProgressIndicator in class ProgressManagerpublic void executeProcessUnderProgress(java.lang.Runnable process,
ProgressIndicator progress)
throws ProcessCanceledException
executeProcessUnderProgress in class ProgressManagerprogress - an indicator to use, null means reuse current progressProcessCanceledExceptionpublic boolean runInReadActionWithWriteActionPriority(java.lang.Runnable action,
ProgressIndicator indicator)
ProgressManagerProgressManager.checkCanceled() or
ProgressIndicator.checkCanceled() often enough).
It returns true if action was executed successfully. It returns false if the action was not
executed successfully, i.e. if:
ProcessCanceledException when some other thread initiated
write actionrunInReadActionWithWriteActionPriority in class ProgressManageraction - the code to execute under read actionindicator - progress indicator that should be cancelled if a write action is about to start. Can be null.protected com.intellij.openapi.progress.impl.CoreProgressManager.CheckCanceledHook createCheckCanceledHook()
protected void indicatorCanceled(ProgressIndicator indicator)
indicatorCanceled in class ProgressManagerpublic static boolean isCanceledThread(java.lang.Thread thread)
public boolean isInNonCancelableSection()
isInNonCancelableSection in class ProgressManagerpublic <T,E extends java.lang.Throwable> T computePrioritized(ThrowableComputable<T,E> computable) throws E extends java.lang.Throwable
ProgressManagerProgressManager.checkCanceled().
This is intended for relatively short (expected to be under 10 seconds) background activities that the user is waiting for
(e.g. code navigation), and which shouldn't be slowed down by CPU-intensive background tasks like highlighting or indexing.computePrioritized in class ProgressManagerE extends java.lang.Throwableprotected void prioritizingStarted()
protected void prioritizingFinished()
public boolean isPrioritizedThread(java.lang.Thread from)
public void suppressPrioritizing()
public void restorePrioritizing()
protected boolean sleepIfNeededToGivePriorityToAnotherThread()
public static ModalityState getCurrentThreadProgressModality()
public static void assertUnderProgress(ProgressIndicator indicator)