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
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:
-
Field Summary
Fields inherited from class javax.swing.undo.CompoundEdit
edits
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
die()
void
protected void
firePropertyChangeEvent
(String name, boolean oldValue, boolean newValue) boolean
void
redo()
protected void
redoTo
(UndoableEdit edit) void
void
reset()
protected void
trimEdits
(int from, int to) void
undo()
void
Methods inherited from class javax.swing.undo.UndoManager
addEdit, canRedo, canUndo, canUndoOrRedo, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, setLimit, toString, trimForLimit, undoOrRedo, undoTo
Methods inherited from class javax.swing.undo.CompoundEdit
getPresentationName, isInProgress, isSignificant, lastEdit
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
-
Constructor Details
-
TextUndoManager
public TextUndoManager()Creates a new instance of TextUndoManager.
-
-
Method Details
-
addPropertyChangeListener
-
die
public void die()- Specified by:
die
in interfaceUndoableEdit
- Overrides:
die
in classCompoundEdit
-
discardAllEdits
public void discardAllEdits()- Overrides:
discardAllEdits
in classUndoManager
-
firePropertyChangeEvent
-
hasChanged
public boolean hasChanged() -
redo
- Specified by:
redo
in interfaceUndoableEdit
- Overrides:
redo
in classUndoManager
- Throws:
CannotRedoException
-
redoTo
- Overrides:
redoTo
in classUndoManager
-
removePropertyChangeListener
-
reset
public void reset() -
trimEdits
protected void trimEdits(int from, int to) - Overrides:
trimEdits
in classUndoManager
-
undo
- Specified by:
undo
in interfaceUndoableEdit
- Overrides:
undo
in classUndoManager
- Throws:
CannotUndoException
-
undoableEditHappened
- Specified by:
undoableEditHappened
in interfaceUndoableEditListener
- Overrides:
undoableEditHappened
in classUndoManager
-