Class RUndoManager

All Implemented Interfaces:
Serializable, EventListener, UndoableEditListener, UndoableEdit

public class RUndoManager extends 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
See Also:
  • Field Details

  • Constructor Details

    • RUndoManager

      public RUndoManager(RTextArea textArea)
      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

      public String getCantRedoText()
      Returns the localized "Can't Redo" string.
      Returns:
      The localized "Can't Redo" string.
      See Also:
    • getCantUndoText

      public String 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 interface UndoableEdit
      Overrides:
      redo in class UndoManager
    • startCompoundEdit

      private RUndoManager.RCompoundEdit startCompoundEdit(UndoableEdit edit)
    • undo

      public void undo()
      Specified by:
      undo in interface UndoableEdit
      Overrides:
      undo in class UndoManager
    • undoableEditHappened

      public void undoableEditHappened(UndoableEditEvent e)
      Specified by:
      undoableEditHappened in interface UndoableEditListener
      Overrides:
      undoableEditHappened in class UndoManager
    • updateActions

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