Package groovy.console.ui.text
Class TextUndoManager
java.lang.Object
javax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CompoundEdit
javax.swing.undo.UndoManager
groovy.console.ui.text.TextUndoManager
- All Implemented Interfaces:
Serializable,EventListener,UndoableEditListener,UndoableEdit
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).
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description TextUndoManager()Creates a new instance of TextUndoManager. -
Method Summary
Modifier and Type Method Description voidaddPropertyChangeListener(PropertyChangeListener pcl)voiddie()voiddiscardAllEdits()protected voidfirePropertyChangeEvent(String name, boolean oldValue, boolean newValue)booleanhasChanged()voidredo()protected voidredoTo(UndoableEdit edit)voidremovePropertyChangeListener(PropertyChangeListener pcl)voidreset()protected voidtrimEdits(int from, int to)voidundo()voidundoableEditHappened(UndoableEditEvent uee)Methods inherited from class javax.swing.undo.UndoManager
addEdit, canRedo, canUndo, canUndoOrRedo, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, setLimit, toString, trimForLimit, undoOrRedo, undoToMethods inherited from class javax.swing.undo.CompoundEdit
getPresentationName, isInProgress, isSignificant, lastEdit
-
Constructor Details
-
TextUndoManager
public TextUndoManager()Creates a new instance of TextUndoManager.
-
-
Method Details
-
addPropertyChangeListener
-
die
public void die()- Specified by:
diein interfaceUndoableEdit- Overrides:
diein classCompoundEdit
-
discardAllEdits
public void discardAllEdits()- Overrides:
discardAllEditsin classUndoManager
-
firePropertyChangeEvent
-
hasChanged
public boolean hasChanged() -
redo
- Specified by:
redoin interfaceUndoableEdit- Overrides:
redoin classUndoManager- Throws:
CannotRedoException
-
redoTo
- Overrides:
redoToin classUndoManager
-
removePropertyChangeListener
-
reset
public void reset() -
trimEdits
protected void trimEdits(int from, int to)- Overrides:
trimEditsin classUndoManager
-
undo
- Specified by:
undoin interfaceUndoableEdit- Overrides:
undoin classUndoManager- Throws:
CannotUndoException
-
undoableEditHappened
- Specified by:
undoableEditHappenedin interfaceUndoableEditListener- Overrides:
undoableEditHappenedin classUndoManager
-