Package: groovy.console.ui.text

## [Java] Class TextUndoManager

- groovy.console.ui.text.TextUndoManager

-     public class TextUndoManager
      extends UndoManager

  To use this, simply drop this as an UndoableEditListener into your document, and then create actions to call undo/redo as needed (checking can undo/redo first, of course).

- - ### Constructor Summary

    Constructors
    Constructor and description
    `TextUndoManager()` Creates a new instance of TextUndoManager.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `addPropertyChangeListener(PropertyChangeListener pcl)` Registers a listener for undo/redo state changes.
    `` | `public void` | `die()` {@inheritDoc}
    `` | `public void` | `discardAllEdits()` {@inheritDoc}
    `` | `protected void` | `firePropertyChangeEvent(String name, boolean oldValue, boolean newValue)` Fires an undo-state property change event.
    `` | `public boolean` | `hasChanged()` Indicates whether the document differs from the last reset point.
    `` | `public void` | `redo()` {@inheritDoc}
    `` | `protected void` | `redoTo(UndoableEdit edit)` {@inheritDoc}
    `` | `public void` | `removePropertyChangeListener(PropertyChangeListener pcl)` Removes a listener for undo/redo state changes.
    `` | `public void` | `reset()` Marks the current undo position as the unmodified state.
    `` | `public void` | `setRecording(boolean recording)` Toggle recording of undoable edits.
    `` | `protected void` | `trimEdits(int from, int to)` {@inheritDoc}
    `` | `public void` | `undo()` {@inheritDoc}
    `` | `public void` | `undoableEditHappened(UndoableEditEvent uee)` {@inheritDoc}

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class UndoManager` | `addEdit, canRedo, canUndo, canUndoOrRedo, die, discardAllEdits, end, equals, getClass, getLimit, getPresentationName, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, hashCode, isInProgress, isSignificant, notify, notifyAll, redo, replaceEdit, setLimit, toString, undo, undoOrRedo, undoableEditHappened, wait, wait, wait`

- - ### Constructor Detail

    - #### public TextUndoManager()

      Creates a new instance of TextUndoManager.

  - ### Method Detail

    - #### public void addPropertyChangeListener(PropertyChangeListener pcl)

      Registers a listener for undo/redo state changes.

      Parameters:
        `pcl` - the listener to add

    - #### public void die()

      {@inheritDoc}

    - #### public void discardAllEdits()

      {@inheritDoc}

    - #### protected void firePropertyChangeEvent(String name, boolean oldValue, boolean newValue)

      Fires an undo-state property change event.

      Parameters:
        `name` - the property name
        `oldValue` - the previous value
        `newValue` - the new value

    - #### public boolean hasChanged()

      Indicates whether the document differs from the last reset point.

      Returns:
        `true` if undo history contains unreset edits

    - #### public void redo()

      {@inheritDoc}

    - #### protected void redoTo(UndoableEdit edit)

      {@inheritDoc}

    - #### public void removePropertyChangeListener(PropertyChangeListener pcl)

      Removes a listener for undo/redo state changes.

      Parameters:
        `pcl` - the listener to remove

    - #### public void reset()

      Marks the current undo position as the unmodified state.

    - #### public void setRecording(boolean recording)

      Toggle recording of undoable edits. Used to suppress capture of programmatic style changes (e.g. a theme switch re-parsing the document) that shouldn't be reachable via user-initiated Undo.

      Since:
        6.0.0

    - #### protected void trimEdits(int from, int to)

      {@inheritDoc}

    - #### public void undo()

      {@inheritDoc}

    - #### public void undoableEditHappened(UndoableEditEvent uee)

      {@inheritDoc}