public abstract class AbstractAsynchronousCustomFeature extends AbstractCustomFeature
This class should be used if for some reason a CustomFeature can be long to
execute. It runs execute(ICustomContext, IProgressMonitor)
in a
Command on top of current TransactionalEditingDomain. This command itself is
run in a Job, and can use the associated IProgressMonitor
This is useful to indicate to users that the job is running, but eclipse has not crashed.
Constructor and Description |
---|
AbstractAsynchronousCustomFeature(IFeatureProvider fp) |
Modifier and Type | Method and Description |
---|---|
void |
execute(IContext context)
Must not be overridden in order to guarantee correct delegation to the
background job, see
execute(ICustomContext) . |
void |
execute(ICustomContext context)
The implementation of this method will during the execution of the
feature trigger the creation of a background job, configure it and
execute it.
Clients should implement their feature functionality in execute(ICustomContext, IProgressMonitor) , potentially also in
the beforeJobExecution() and afterJobExecution() hooks. |
boolean |
hasDoneChanges()
The default implementation returns
false in any case. |
canExecute, canExecute, getDescription, getImageId, isAvailable
canUndo, getFeatureProvider, getName, manageFont, manageFont, setProgressCallback, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFeatureProvider
public AbstractAsynchronousCustomFeature(IFeatureProvider fp)
public final void execute(IContext context)
execute(ICustomContext)
.execute
in interface IFeature
execute
in class AbstractCustomFeature
context
- this is the general input for this methodIContext
public final void execute(ICustomContext context)
execute(ICustomContext, IProgressMonitor)
, potentially also in
the beforeJobExecution()
and afterJobExecution()
hooks.
The background job and its behavior can be changed in the methods
initializeJob(ICustomContext)
and configureJob(Job)
.context
- The CustomFeature contextpublic final boolean hasDoneChanges()
false
in any case. This
is usually the desired return value, because this method will be queried
already before the asynchronous feature will be executed (
execute(ICustomContext, IProgressMonitor)
is called). Returning
true
here would mean that users could already undo the
feature while it is still being executed; this would mean also canceling
the a running job. Because of potentially strange effects and complexity
this is not possible.hasDoneChanges
in interface IFeature
hasDoneChanges
in class AbstractFeature
false