# Class LinearUndoEnforcer

java.lang.Object
org.eclipse.core.commands.operations.LinearUndoViolationDetector
org.eclipse.core.commands.operations.LinearUndoEnforcer

All Implemented Interfaces:
  `IOperationApprover`

public final class LinearUndoEnforcer extends LinearUndoViolationDetector

An operation approver that enforces a strict linear undo. It does not allow the undo or redo of any operation that is not the latest available operation in all of its undo contexts. This class may be instantiated by clients.

Since:
  3.1

## Constructor Summary

Constructors
Constructor
Description
`LinearUndoEnforcer()`
Create an instance of LinearUndoEnforcer.

## Method Summary

Modifier and Type
Method
Description
`protected IStatus`
`allowLinearRedoViolation(IUndoableOperation operation, IUndoContext context, IOperationHistory history, IAdaptable uiInfo)`
Return a status indicating whether a linear redo violation is allowable.
`protected IStatus`
`allowLinearUndoViolation(IUndoableOperation operation, IUndoContext context, IOperationHistory history, IAdaptable uiInfo)`
Return a status indicating whether a linear undo violation is allowable.

### Methods inherited from class LinearUndoViolationDetector

`proceedRedoing, proceedUndoing`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LinearUndoEnforcer

public LinearUndoEnforcer()
Create an instance of LinearUndoEnforcer.

## Method Details

### allowLinearRedoViolation

protected IStatus allowLinearRedoViolation(IUndoableOperation operation, IUndoContext context, IOperationHistory history, IAdaptable uiInfo)
Description copied from class: `LinearUndoViolationDetector`
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.

Specified by:
  `allowLinearRedoViolation` in class `LinearUndoViolationDetector`
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
  `uiInfo` - 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 IStatus allowLinearUndoViolation(IUndoableOperation operation, IUndoContext context, IOperationHistory history, IAdaptable uiInfo)
Description copied from class: `LinearUndoViolationDetector`
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.

Specified by:
  `allowLinearUndoViolation` in class `LinearUndoViolationDetector`
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
  `uiInfo` - 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.