|
|
|
|
org.eclipse.core.commands.operations
Interface IAdvancedUndoableOperation
-
All Known Implementing Classes:
-
AbstractWorkspaceOperation,
CopyProjectOperation,
CopyResourcesOperation,
CreateFileOperation,
CreateFolderOperation,
CreateMarkersOperation,
CreateProjectOperation,
DeleteMarkersOperation,
DeleteResourcesOperation,
MoveProjectOperation,
MoveResourcesOperation,
TriggeredOperations,
UpdateMarkersOperation
-
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.
-
Since:
- 3.1
aboutToNotify
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.
-
-
Parameters:
-
event - the event that is about to be sent with the pending
notification
getAffectedObjects
Object[] 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.
-
-
Returns:
- the array of Objects modified by this operation, or
null if the affected objects cannot be determined.
computeUndoableStatus
IStatus computeUndoableStatus(
IProgressMonitor monitor)
throws
ExecutionException
- Return a status indicating the projected outcome of undoing the receiver.
This method should be used to report the possible outcome of an undo and
is used when computing the validity of an undo is too expensive to
perform in
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() .
-
-
Parameters:
-
monitor - the progress monitor (or null ) to use for
reporting progress to the user while computing the validity.
-
Returns:
- the IStatus indicating the validity of the undo. The status
severity should be set to
OK if the undo can
successfully be performed, and ERROR if it
cannnot. Any other status is assumed to represent an ambiguous
state.
-
Throws:
-
ExecutionException
- if an exception occurs while computing the validity.
computeRedoableStatus
IStatus computeRedoableStatus(
IProgressMonitor monitor)
throws
ExecutionException
- Return a status indicating the projected outcome of redoing the receiver.
This method should be used to report the possible outcome of a redo and
is used when computing the validity of a redo is too expensive to perform
in
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() .
-
-
Parameters:
-
monitor - the progress monitor (or null ) to use for
reporting progress to the user while computing the validity.
-
Returns:
- the IStatus indicating the validity of the redo. The status
severity should be set to
OK if the redo can
successfully be performed, and ERROR if it
cannnot. Any other status is assumed to represent an ambiguous
state.
-
Throws:
-
ExecutionException
- if an exception occurs while computing the validity.
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.
|
|
|