public abstract class AaxlReadOnlyActionAsJob extends AbstractAaxlAction
AbstractAaxlAction.doAaxlAction(IProgressMonitor, Element)
method. The
AbstractAaxlAction.getMarkerType()
method should also be overridden to return the name
of the marker type the analysis should use to report errors. The method
getActionName()
must be implemented to return the name of the
analysis job. This name is used by the Eclipse UI when the showing
information about the current job, or the list of active jobs, etc.
The action is invoked in a WorkspaceJob
.
As an workspace job, a single workspace event (if any) is sent at the end of
the action, and, more importantly, the workspace is locked from the root
object. Thus the action has exclusive access to all the models in the
workspace. The job is not
guaranteed to run in the SWT/UI thread.
The user must use
Display.asyncExec(java.lang.Runnable)
or
Display.syncExec(java.lang.Runnable)
to
ensure that dialog boxes (if any) are manipulated in the SWT/UI thread. OSATE
provides the convenience class
Dialog
that opens up
informative
,
warning
,
error
,
and
question
dialog boxes using the SWT/UI thread.
The body of the action,
AbstractAaxlAction.doAaxlAction(IProgressMonitor, Element)
is passed the Eclipse progress monitor and the currently selected Element in
the workspace. It is the responsibility of the subclass to initialize and use
the progress monitor. That is, at the minimum, the subclass is expected to
call
IProgressMonitor.beginTask(java.lang.String, int)
and IProgressMonitor.done()
on the progress
monitor.
A long-running analysis should also periodically check if the user
has cancelled the operation by polling
IProgressMonitor.isCanceled()
. Note that,
the OSATE traversal class edu.cmu.sei.aadl.model.util.ForAllAObject
supports cancellation via the protected cancelTraversal
method. This is best used via the
edu.cmu.sei.aadl.model.util.AadlProcessingSwitchWithProgress
subclass
that takes a reference to the progress monitor when it is constructed.
Traversals can then poll the progress monitor and cancel the traversal if needed within "case" methods by
using the method checkIfCancelled
. Traversals
can also update the progress monitor via
IProgressMonitor.subTask(java.lang.String)
and IProgressMonitor.worked(int)
from within
"case" methods.
If the action ends prematurely becuase it is responding to a cancellation
request, doAaxlAction
should throw an
OperationCanceledException
.
Constructor and Description |
---|
AaxlReadOnlyActionAsJob() |
dispose, init, run, selectionChanged, setActivePart