public void updateActions(){
  String text;
  Action a=RTextArea.getAction(RTextArea.UNDO_ACTION);
  if (canUndo()) {
    a.setEnabled(true);
    text=getUndoPresentationName();
    a.putValue(Action.NAME,text);
    a.putValue(Action.SHORT_DESCRIPTION,text);
  }
 else {
    if (a.isEnabled()) {
      a.setEnabled(false);
      text=cantUndoText;
      a.putValue(Action.NAME,text);
      a.putValue(Action.SHORT_DESCRIPTION,text);
    }
  }
  a=RTextArea.getAction(RTextArea.REDO_ACTION);
  if (canRedo()) {
    a.setEnabled(true);
    text=getRedoPresentationName();
    a.putValue(Action.NAME,text);
    a.putValue(Action.SHORT_DESCRIPTION,text);
  }
 else {
    if (a.isEnabled()) {
      a.setEnabled(false);
      text=cantRedoText;
      a.putValue(Action.NAME,text);
      a.putValue(Action.SHORT_DESCRIPTION,text);
    }
  }
}

public void updateActions ( ) { String text ; Action a = RTextArea . getAction ( RTextArea . UNDO_ACTION ) ; if ( canUndo ( ) ) { a . setEnabled ( true ) ; text = getUndoPresentationName ( ) ; a . putValue ( Action . NAME , text ) ; a . putValue ( Action . SHORT_DESCRIPTION , text ) ; } else { if ( a . isEnabled ( ) ) { a . setEnabled ( false ) ; text = cantUndoText ; a . putValue ( Action . NAME , text ) ; a . putValue ( Action . SHORT_DESCRIPTION , text ) ; } } a = RTextArea . getAction ( RTextArea . REDO_ACTION ) ; if ( canRedo ( ) ) { a . setEnabled ( true ) ; text = getRedoPresentationName ( ) ; a . putValue ( Action . NAME , text ) ; a . putValue ( Action . SHORT_DESCRIPTION , text ) ; } else { if ( a . isEnabled ( ) ) { a . setEnabled ( false ) ; text = cantRedoText ; a . putValue ( Action . NAME , text ) ; a . putValue ( Action . SHORT_DESCRIPTION , text ) ; } } }
ensures that undo / redo actions are enabled appropriately and have descriptive text at all times .
