Class LinearUndoViolationDetector
java.lang.Object
org.eclipse.core.commands.operations.LinearUndoViolationDetector
- All Implemented Interfaces:
IOperationApprover
- Direct Known Subclasses:
LinearUndoEnforcer
,LinearUndoViolationUserApprover
An abstract class for detecting violations in a strict linear undo/redo model. Once a violation is detected, subclasses implement the specific behavior for indicating whether or not the undo/redo should proceed.
- Since:
- 3.1
-
Constructor Summary
ConstructorDescriptionCreate an instance of LinearUndoViolationDetector. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract IStatus
allowLinearRedoViolation
(IUndoableOperation operation, IUndoContext context, IOperationHistory history, IAdaptable info) Return a status indicating whether a linear redo violation is allowable.protected abstract IStatus
allowLinearUndoViolation
(IUndoableOperation operation, IUndoContext context, IOperationHistory history, IAdaptable info) Return a status indicating whether a linear undo violation is allowable.final IStatus
proceedRedoing
(IUndoableOperation operation, IOperationHistory history, IAdaptable info) Return a status indicating whether the specified operation should be redone.final IStatus
proceedUndoing
(IUndoableOperation operation, IOperationHistory history, IAdaptable info) Return a status indicating whether the specified operation should be undone.
-
Constructor Details
-
LinearUndoViolationDetector
public LinearUndoViolationDetector()Create an instance of LinearUndoViolationDetector.
-
-
Method Details
-
allowLinearRedoViolation
protected abstract IStatus allowLinearRedoViolation(IUndoableOperation operation, IUndoContext context, IOperationHistory history, IAdaptable info) Return a status indicating whether a linear redo violation is allowable. A linear redo violation is defined as a request to redo a particular operation even if it is not the most recently added operation to the redo history.- Parameters:
operation
- the operation for which a linear redo violation has been detected.context
- the undo context in which the linear redo violation existshistory
- the operation history containing the operationinfo
- the IAdaptable (ornull
) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is notnull
, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class.- Returns:
- the IStatus describing whether the redo violation is allowed. The
redo will not proceed if the status severity is not
OK
, and the caller requesting the redo will be returned the status that caused the rejection. Specific status severities will not be interpreted by the history.
-
allowLinearUndoViolation
protected abstract IStatus allowLinearUndoViolation(IUndoableOperation operation, IUndoContext context, IOperationHistory history, IAdaptable info) Return a status indicating whether a linear undo violation is allowable. A linear undo violation is defined as a request to undo a particular operation even if it is not the most recently added operation to the undo history.- Parameters:
operation
- the operation for which a linear undo violation has been detected.context
- the undo context in which the linear undo violation existshistory
- the operation history containing the operationinfo
- the IAdaptable (ornull
) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is notnull
, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class.- Returns:
- the IStatus describing whether the undo violation is allowed. The
undo will not proceed if the status severity is not
OK
, and the caller requesting the undo will be returned the status that caused the rejection. Specific status severities will not be interpreted by the history.
-
proceedRedoing
public final IStatus proceedRedoing(IUndoableOperation operation, IOperationHistory history, IAdaptable info) Description copied from interface:IOperationApprover
Return a status indicating whether the specified operation should be redone. Any status that does not have severityIStatus.OK
will not be approved. Implementers should not assume that the redo will be performed when the status isOK
, since other operation approvers may veto the redo.- Specified by:
proceedRedoing
in interfaceIOperationApprover
- Parameters:
operation
- the operation to be redonehistory
- the history redoing the operationinfo
- the IAdaptable (ornull
) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is notnull
, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class. Even if UI information is provided, the implementation of this method must be prepared for being called from a background thread. Any UI access must be properly synchronized using the techniques specified by the client's widget library.- Returns:
- the IStatus describing whether the operation is approved. The
redo will not proceed if the status severity is not
OK
, and the caller requesting the redo will be returned the status that caused the rejection. Any other status severities will not be interpreted by the history.
-
proceedUndoing
public final IStatus proceedUndoing(IUndoableOperation operation, IOperationHistory history, IAdaptable info) Description copied from interface:IOperationApprover
Return a status indicating whether the specified operation should be undone. Any status that does not have severityIStatus.OK
will not be approved. Implementers should not assume that the undo will be performed when the status isOK
, since other operation approvers can veto the undo.- Specified by:
proceedUndoing
in interfaceIOperationApprover
- Parameters:
operation
- the operation to be undonehistory
- the history undoing the operationinfo
- the IAdaptable (ornull
) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is notnull
, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class. Even if UI information is provided, the implementation of this method must be prepared for being called from a background thread. Any UI access must be properly synchronized using the techniques specified by the client's widget library.- Returns:
- the IStatus describing whether the operation is approved. The
undo will not proceed if the status severity is not
OK
, and the caller requesting the undo will be returned the status that caused the rejection. Any other status severities will not be interpreted by the history.
-