public Collection<Object> undo(){
  HashSet<Object> modifiedObjects=null;
  boolean done=false;
  while ((indexOfNextAdd > 0) && !done) {
    List<mxUndoableEdit> edits=history.get(--indexOfNextAdd);
    for (int i=edits.size() - 1; i >= 0; i--) {
      mxUndoableEdit edit=edits.get(i);
      edit.undo();
      modifiedObjects=edit.getAffectedObjects();
      if (edit.isSignificant()) {
        fireEvent(new mxEventObject(mxEvent.UNDO,"edit",edit));
        done=true;
      }
    }
  }
  return modifiedObjects;
}

public Collection < Object > undo ( ) { HashSet < Object > modifiedObjects = null ; boolean done = false ; while ( ( indexOfNextAdd > 0 ) && ! done ) { List < mxUndoableEdit > edits = history . get ( -- indexOfNextAdd ) ; for ( int i = edits . size ( ) - 1 ; i >= 0 ; i -- ) { mxUndoableEdit edit = edits . get ( i ) ; edit . undo ( ) ; modifiedObjects = edit . getAffectedObjects ( ) ; if ( edit . isSignificant ( ) ) { fireEvent ( new mxEventObject ( mxEvent . UNDO , "edit" , edit ) ) ; done = true ; } } } return modifiedObjects ; }
undoes the last change .
