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 and description |
|---|
TextUndoManager()Creates a new instance of TextUndoManager. |
| 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} |
| 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 |
Registers a listener for undo/redo state changes.
pcl - the listener to add{@inheritDoc}
{@inheritDoc}
Fires an undo-state property change event.
name - the property nameoldValue - the previous valuenewValue - the new valueIndicates whether the document differs from the last reset point.
true if undo history contains unreset edits{@inheritDoc}
{@inheritDoc}
Removes a listener for undo/redo state changes.
pcl - the listener to removeMarks the current undo position as the unmodified state.
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.
{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.