/** Returns the the next significant edit to be undone if undo is called. May return null */
  protected UndoableEdit editToBeUndone() {
    int i = indexOfNextAdd;
    while (i > 0) {
      UndoableEdit edit = (UndoableEdit) edits.elementAt(--i);
      if (edit.isSignificant()) {
        return edit;
      }
    }

    return null;
  }
  /** Returns the the next significant edit to be redone if redo is called. May return null */
  protected UndoableEdit editToBeRedone() {
    int count = edits.size();
    int i = indexOfNextAdd;

    while (i < count) {
      UndoableEdit edit = (UndoableEdit) edits.elementAt(i++);
      if (edit.isSignificant()) {
        return edit;
      }
    }

    return null;
  }