public class FormattingProgressTask extends SequentialModalProgressTask implements FormattingProgressCallback
Task.Backgroundable, Task.ConditionalModal, Task.Modal, Task.NotificationInfo, Task.WithResult<T,E extends java.lang.Exception>
FormattingProgressCallback.EventType
Modifier and Type | Field and Description |
---|---|
static java.lang.ThreadLocal<java.lang.Boolean> |
FORMATTING_CANCELLED_FLAG |
EMPTY
Constructor and Description |
---|
FormattingProgressTask(Project project,
PsiFile file,
Document document) |
Modifier and Type | Method and Description |
---|---|
boolean |
addCallback(FormattingProgressCallback.EventType eventType,
java.lang.Runnable callback)
Allows to register callback for the target event type.
|
void |
afterApplyingChange(LeafBlockWrapper block)
Notifies current indicator that change from the given
wrapped code block is successfully flushed
to the underlying document. |
void |
afterProcessingBlock(LeafBlockWrapper block)
Notifies current indicator that given
wrapped code block is processed, i.e. |
void |
afterWrappingBlock(LeafBlockWrapper wrapped)
Notifies current indicator that particular
code block is wrapped. |
void |
beforeApplyingFormatChanges(java.util.Collection<LeafBlockWrapper> modifiedBlocks)
Notifies current indicator that changes from the given
wrapped code blocks are about to be flushed
to the underlying document. |
void |
onCancel()
This callback will be invoked on AWT dispatch thread.
|
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.
|
protected void |
prepare(SequentialTask task)
Executes preliminary jobs prior to the target sequential task processing (
SequentialTask.prepare() by default). |
doRun, getIndicator, run, setMinIterationTime, setTask
isModal
asBackgroundable, asModal, getCancelText, getCancelTooltipText, getNotificationInfo, getProject, getTitle, isCancellable, isHeadless, notifyFinished, onError, onFinished, queue, setCancelText, setCancelTooltipText, setTitle, whereToRunCallbacks
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setTask
public static final java.lang.ThreadLocal<java.lang.Boolean> FORMATTING_CANCELLED_FLAG
protected void prepare(SequentialTask task)
SequentialModalProgressTask
SequentialTask.prepare()
by default).prepare
in class SequentialModalProgressTask
task
- task to be executedpublic boolean addCallback(FormattingProgressCallback.EventType eventType, java.lang.Runnable callback)
FormattingProgressCallback
addCallback
in interface FormattingProgressCallback
eventType
- target event typecallback
- callback to register for the given event typetrue
if given callback is successfully registered for the given event type;
false
otherwisepublic void onSuccess()
Task
public void onCancel()
Task
ProcessCanceledException
or if its ProgressIndicator
was canceled.public void onThrowable(java.lang.Throwable error)
Task
Callback executed when Progressive.run(ProgressIndicator)
throws an exception (except ProcessCanceledException
).
onThrowable
in class Task
public void afterWrappingBlock(LeafBlockWrapper wrapped)
FormattingProgressCallback
code block
is wrapped.afterWrappingBlock
in interface FormattingProgressCallback
wrapped
- wrapped code blockFormattingStateId.WRAPPING_BLOCKS
public void afterProcessingBlock(LeafBlockWrapper block)
FormattingProgressCallback
wrapped code block
is processed, i.e. its
white space
is adjusted as necessary.afterProcessingBlock
in interface FormattingProgressCallback
block
- processed wrapped block which white space if adjustedFormattingStateId.PROCESSING_BLOCKS
public void beforeApplyingFormatChanges(java.util.Collection<LeafBlockWrapper> modifiedBlocks)
FormattingProgressCallback
wrapped code blocks
are about to be flushed
to the underlying document.beforeApplyingFormatChanges
in interface FormattingProgressCallback
modifiedBlocks
- blocks with modified white spaces
which are about
to be flushed to the underlying documentFormattingStateId.APPLYING_CHANGES
public void afterApplyingChange(LeafBlockWrapper block)
FormattingProgressCallback
wrapped code block
is successfully flushed
to the underlying document.afterApplyingChange
in interface FormattingProgressCallback
block
- wrapped code block
which change is successfully flushed to the underlying documentFormattingStateId.APPLYING_CHANGES