Class LinearUndoViolationDetector

java.lang.Object
org.eclipse.core.commands.operations.LinearUndoViolationDetector
All Implemented Interfaces:
IOperationApprover
Direct Known Subclasses:
LinearUndoEnforcer, LinearUndoViolationUserApprover

public abstract class LinearUndoViolationDetector extends Object implements IOperationApprover

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 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 exists
      history - the operation history containing the operation
      info - the IAdaptable (or null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not null, 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 exists
      history - the operation history containing the operation
      info - the IAdaptable (or null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not null, 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 severity IStatus.OK will not be approved. Implementers should not assume that the redo will be performed when the status is OK, since other operation approvers may veto the redo.
      Specified by:
      proceedRedoing in interface IOperationApprover
      Parameters:
      operation - the operation to be redone
      history - the history redoing the operation
      info - the IAdaptable (or null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not null, 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 severity IStatus.OK will not be approved. Implementers should not assume that the undo will be performed when the status is OK, since other operation approvers can veto the undo.
      Specified by:
      proceedUndoing in interface IOperationApprover
      Parameters:
      operation - the operation to be undone
      history - the history undoing the operation
      info - the IAdaptable (or null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not null, 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.