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:
java.io.Serializable
,java.util.EventListener
,javax.swing.event.UndoableEditListener
,javax.swing.undo.UndoableEdit
public class TextUndoManager
extends javax.swing.undo.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
Fields inherited from class javax.swing.undo.CompoundEdit
edits
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
-
Constructor Summary
Constructors Constructor Description TextUndoManager()
Creates a new instance of TextUndoManager. -
Method Summary
Modifier and Type Method Description void
addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
void
die()
void
discardAllEdits()
protected void
firePropertyChangeEvent(java.lang.String name, boolean oldValue, boolean newValue)
boolean
hasChanged()
void
redo()
protected void
redoTo(javax.swing.undo.UndoableEdit edit)
void
removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
void
reset()
protected void
trimEdits(int from, int to)
void
undo()
void
undoableEditHappened(javax.swing.event.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, undoTo
Methods inherited from class javax.swing.undo.CompoundEdit
getPresentationName, isInProgress, isSignificant, lastEdit
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
TextUndoManager
public TextUndoManager()Creates a new instance of TextUndoManager.
-
-
Method Details
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl) -
die
public void die()- Specified by:
die
in interfacejavax.swing.undo.UndoableEdit
- Overrides:
die
in classjavax.swing.undo.CompoundEdit
-
discardAllEdits
public void discardAllEdits()- Overrides:
discardAllEdits
in classjavax.swing.undo.UndoManager
-
firePropertyChangeEvent
protected void firePropertyChangeEvent(java.lang.String name, boolean oldValue, boolean newValue) -
hasChanged
public boolean hasChanged() -
redo
public void redo() throws javax.swing.undo.CannotRedoException- Specified by:
redo
in interfacejavax.swing.undo.UndoableEdit
- Overrides:
redo
in classjavax.swing.undo.UndoManager
- Throws:
javax.swing.undo.CannotRedoException
-
redoTo
protected void redoTo(javax.swing.undo.UndoableEdit edit)- Overrides:
redoTo
in classjavax.swing.undo.UndoManager
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl) -
reset
public void reset() -
trimEdits
protected void trimEdits(int from, int to)- Overrides:
trimEdits
in classjavax.swing.undo.UndoManager
-
undo
public void undo() throws javax.swing.undo.CannotUndoException- Specified by:
undo
in interfacejavax.swing.undo.UndoableEdit
- Overrides:
undo
in classjavax.swing.undo.UndoManager
- Throws:
javax.swing.undo.CannotUndoException
-
undoableEditHappened
public void undoableEditHappened(javax.swing.event.UndoableEditEvent uee)- Specified by:
undoableEditHappened
in interfacejavax.swing.event.UndoableEditListener
- Overrides:
undoableEditHappened
in classjavax.swing.undo.UndoManager
-