public abstract class Task extends java.lang.Object implements TaskInfo, Progressive
new Task.Backgroundable(project, "Synchronizing data", true) { public void run(ProgressIndicator indicator) { indicator.setText("Loading changes"); indicator.setIndeterminate(false); indicator.setFraction(0.0); // some code indicator.setFraction(1.0); } }.setCancelText("Stop loading").queue();
ProgressManager.run(Task)
Modifier and Type | Class and Description |
---|---|
static class |
Task.Backgroundable |
static class |
Task.ConditionalModal |
static class |
Task.Modal |
static class |
Task.NotificationInfo |
static class |
Task.WithResult<T,E extends java.lang.Exception> |
Modifier and Type | Field and Description |
---|---|
protected Project |
myProject |
protected java.lang.String |
myTitle |
Modifier and Type | Method and Description |
---|---|
Task.Backgroundable |
asBackgroundable() |
Task.Modal |
asModal() |
java.lang.String |
getCancelText() |
java.lang.String |
getCancelTooltipText() |
Task.NotificationInfo |
getNotificationInfo() |
Project |
getProject() |
java.lang.String |
getTitle() |
boolean |
isCancellable() |
boolean |
isHeadless() |
abstract boolean |
isModal() |
Task.NotificationInfo |
notifyFinished() |
void |
onCancel()
This callback will be invoked on AWT dispatch thread.
|
void |
onError(java.lang.Exception error)
Deprecated.
use
onThrowable(Throwable) instead |
void |
onFinished()
This callback will be invoked on AWT dispatch thread, after other specific handlers.
|
void |
onSuccess()
This callback will be invoked on AWT dispatch thread.
|
void |
onThrowable(java.lang.Throwable error)
This callback will be invoked on AWT dispatch thread.
|
void |
queue() |
Task |
setCancelText(java.lang.String cancelText) |
Task |
setCancelTooltipText(java.lang.String cancelTooltipText) |
Task |
setTitle(java.lang.String title) |
EdtReplacementThread |
whereToRunCallbacks()
Specifies the thread to run callbacks on.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run
protected final Project myProject
protected java.lang.String myTitle
public void onCancel()
ProcessCanceledException
or if its ProgressIndicator
was canceled.public void onSuccess()
@Deprecated public void onError(java.lang.Exception error)
onThrowable(Throwable)
instead
Callback executed when Progressive.run(ProgressIndicator)
throws an exception (except ProcessCanceledException
).
public void onThrowable(java.lang.Throwable error)
Callback executed when Progressive.run(ProgressIndicator)
throws an exception (except ProcessCanceledException
).
public void onFinished()
public EdtReplacementThread whereToRunCallbacks()
EdtReplacementThread
documentation for more info.public final Project getProject()
public final void queue()
public final Task setTitle(java.lang.String title)
public final java.lang.String getCancelText()
getCancelText
in interface TaskInfo
public final Task setCancelText(java.lang.String cancelText)
public Task.NotificationInfo getNotificationInfo()
public Task.NotificationInfo notifyFinished()
public boolean isHeadless()
public final Task setCancelTooltipText(java.lang.String cancelTooltipText)
public final java.lang.String getCancelTooltipText()
getCancelTooltipText
in interface TaskInfo
public final boolean isCancellable()
isCancellable
in interface TaskInfo
public abstract boolean isModal()
public final Task.Modal asModal()
public final Task.Backgroundable asBackgroundable()