org.fife.ui.rtextarea
Class RUndoManager

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by javax.swing.undo.UndoManager
              extended by org.fife.ui.rtextarea.RUndoManager
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, javax.swing.event.UndoableEditListener, javax.swing.undo.UndoableEdit

public class RUndoManager
extends javax.swing.undo.UndoManager

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
Author:
Robert Futrell
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
RUndoManager(RTextArea textArea)
          Constructor.
 
Method Summary
 void beginInternalAtomicEdit()
          Begins an "atomic" edit.
 void endInternalAtomicEdit()
          Ends an "atomic" edit.
 java.lang.String getCantRedoText()
          Returns the localized "Can't Redo" string.
 java.lang.String getCantUndoText()
          Returns the localized "Can't Undo" string.
 void redo()
          
 void undo()
          
 void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
           
 void updateActions()
          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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RUndoManager

public RUndoManager(RTextArea textArea)
Constructor.

Parameters:
textArea - The parent text area.
Method Detail

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()

endInternalAtomicEdit

public void endInternalAtomicEdit()
Ends an "atomic" edit.

See Also:
beginInternalAtomicEdit()

getCantRedoText

public java.lang.String getCantRedoText()
Returns the localized "Can't Redo" string.

Returns:
The localized "Can't Redo" string.
See Also:
getCantUndoText()

getCantUndoText

public java.lang.String getCantUndoText()
Returns the localized "Can't Undo" string.

Returns:
The localized "Can't Undo" string.
See Also:
getCantRedoText()

redo

public void redo()
          throws javax.swing.undo.CannotRedoException

Specified by:
redo in interface javax.swing.undo.UndoableEdit
Overrides:
redo in class javax.swing.undo.UndoManager
Throws:
javax.swing.undo.CannotRedoException

undo

public void undo()
          throws javax.swing.undo.CannotUndoException

Specified by:
undo in interface javax.swing.undo.UndoableEdit
Overrides:
undo in class javax.swing.undo.UndoManager
Throws:
javax.swing.undo.CannotUndoException

undoableEditHappened

public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
Specified by:
undoableEditHappened in interface javax.swing.event.UndoableEditListener
Overrides:
undoableEditHappened in class javax.swing.undo.UndoManager

updateActions

public void updateActions()
Ensures that undo/redo actions are enabled appropriately and have descriptive text at all times.