Package org.fife.ui.rtextarea
Class RUndoManager
java.lang.Object
javax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CompoundEdit
javax.swing.undo.UndoManager
org.fife.ui.rtextarea.RUndoManager
- All Implemented Interfaces:
Serializable
,EventListener
,UndoableEditListener
,UndoableEdit
This class manages undos/redos for a particular editor pane. It groups
all undos that occur one character position apart together, to avoid
Java's horrible "one character at a time" undo behavior. It also
recognizes "replace" actions (i.e., text is selected, then the user
types), and treats it as a single action, instead of a remove/insert
action pair.
- Version:
- 1.0
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private String
private RUndoManager.RCompoundEdit
private int
private int
private static final String
private RTextArea
Fields inherited from class javax.swing.undo.CompoundEdit
edits
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Begins an "atomic" edit.void
Ends an "atomic" edit.Returns the localized "Can't Redo" string.Returns the localized "Can't Undo" string.void
redo()
private RUndoManager.RCompoundEdit
void
undo()
void
void
Ensures that undo/redo actions are enabled appropriately and have descriptive text at all times.Methods inherited from class javax.swing.undo.UndoManager
addEdit, canRedo, canUndo, canUndoOrRedo, discardAllEdits, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redoTo, setLimit, toString, trimEdits, trimForLimit, undoOrRedo, undoTo
Methods inherited from class javax.swing.undo.CompoundEdit
die, getPresentationName, isInProgress, isSignificant, lastEdit
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
-
Field Details
-
compoundEdit
-
textArea
-
lastOffset
private int lastOffset -
cantUndoText
-
cantRedoText
-
internalAtomicEditDepth
private int internalAtomicEditDepth -
MSG
- See Also:
-
-
Constructor Details
-
RUndoManager
Constructor.- Parameters:
textArea
- The parent text area.
-
-
Method Details
-
beginInternalAtomicEdit
public void beginInternalAtomicEdit()Begins an "atomic" edit. This method is called when RTextArea KNOWS that some edits should be compound automatically, such as when the user is typing in overwrite mode (the deletion of the current char + insertion of the new one) or the playing back of a macro.- See Also:
-
endInternalAtomicEdit
public void endInternalAtomicEdit()Ends an "atomic" edit.- See Also:
-
getCantRedoText
Returns the localized "Can't Redo" string.- Returns:
- The localized "Can't Redo" string.
- See Also:
-
getCantUndoText
Returns the localized "Can't Undo" string.- Returns:
- The localized "Can't Undo" string.
- See Also:
-
redo
public void redo()- Specified by:
redo
in interfaceUndoableEdit
- Overrides:
redo
in classUndoManager
-
startCompoundEdit
-
undo
public void undo()- Specified by:
undo
in interfaceUndoableEdit
- Overrides:
undo
in classUndoManager
-
undoableEditHappened
- Specified by:
undoableEditHappened
in interfaceUndoableEditListener
- Overrides:
undoableEditHappened
in classUndoManager
-
updateActions
public void updateActions()Ensures that undo/redo actions are enabled appropriately and have descriptive text at all times.
-