public interface IAdvancedUndoableOperation
IAdvancedUndoableOperation defines an interface for undoable operations that modify one or more elements in a model and attempt to keep model listeners up to date with changes that occur in the undo and redo history involving particular model elements. It also defines methods for computing the validity of an operation for undo or redo before attempting to perform the undo or redo.
This interface is intended to be used by legacy frameworks that are adapting their original undo and redo support to this framework. The methods in this interface allow legacy clients to maintain features not supported in the basic operations framework.
Modifier and Type | Method and Description |
---|---|
void |
aboutToNotify(OperationHistoryEvent event)
An operation history notification about this operation is about to be
sent to operation history listeners.
|
IStatus |
computeRedoableStatus(IProgressMonitor monitor)
Return a status indicating the projected outcome of redoing the receiver.
|
IStatus |
computeUndoableStatus(IProgressMonitor monitor)
Return a status indicating the projected outcome of undoing the receiver.
|
Object[] |
getAffectedObjects()
Return an array of objects that are affected by executing, undoing, or
redoing this operation.
|
void aboutToNotify(OperationHistoryEvent event)
An operation history notification about this operation is about to be sent to operation history listeners. Any preparation needed before listeners are notified about this operation should be performed here.
This method has been added to support legacy undo frameworks that are adapting to IUndoableOperation. Operations that previously relied on notification from their containing history or stack before any listeners are notified about changes to the operation should implement this interface.
event
- the event that is about to be sent with the pending
notificationObject[] getAffectedObjects()
Return an array of objects that are affected by executing, undoing, or redoing this operation. If it cannot be determined which objects are affected, return null.
null
if the affected objects cannot be determined.IStatus computeUndoableStatus(IProgressMonitor monitor) throws ExecutionException
IUndoableOperation.canUndo()
. It is not called by the
operation history, but instead is used by clients (such as implementers
of IOperationApprover
) who wish to perform advanced validation of
an operation before attempting to undo it.
If the result of this method is the discovery that an operation can in
fact not be undone, then the operation is expected to correctly answer
false
on subsequent calls to
IUndoableOperation.canUndo()
.monitor
- the progress monitor (or null
) to use for
reporting progress to the user while computing the validity.OK
if the undo can
successfully be performed, and ERROR
if it
cannnot. Any other status is assumed to represent an ambiguous
state.ExecutionException
- if an exception occurs while computing the validity.IStatus computeRedoableStatus(IProgressMonitor monitor) throws ExecutionException
IUndoableOperation.canRedo()
. It is not called by the
operation history, but instead is used by clients (such as implementers
of IOperationApprover
) who wish to perform advanced validation of
an operation before attempting to redo it.
If the result of this method is the discovery that an operation can in
fact not be redone, then the operation is expected to correctly answer
false
on subsequent calls to
IUndoableOperation.canRedo()
.monitor
- the progress monitor (or null
) to use for
reporting progress to the user while computing the validity.OK
if the redo can
successfully be performed, and ERROR
if it
cannnot. Any other status is assumed to represent an ambiguous
state.ExecutionException
- if an exception occurs while computing the validity.
Copyright (c) 2000, 2013 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.