public void hasBeenActivated(Editor editor) {
    if (editor == this) {
      Code.debug("hasBeenActivated");
      EditorActionManager eam = getEditorActionManager();
      eam.enableFormatActions(false);
      eam.enableGenericActions(true);
      eam.enableDocumentActions(true);

      // Test the state of the contained file.
      if (hasFile()) {
        if (isNew()) {
          eam.enableAction(
              EditorActionManager.F_R_A_P, false);
          eam.enableAction(
              EditorActionManager.F_S_A_P, true);
        }
        else {
          if (isChanged()) {
            eam.enableAction(
                EditorActionManager.F_R_A_P, true);
            eam.enableAction(
                EditorActionManager.F_S_A_P, true);
          }
          else {
            eam.enableAction(
                EditorActionManager.F_R_A_P, true);
            eam.enableAction(
                EditorActionManager.F_S_A_P, false);
          }
        }
      }
      else {
        eam.enableAction(
            EditorActionManager.F_S_A_P, true);
        eam.enableAction(
            EditorActionManager.F_R_A_P, false);
      }
      // Enable/disable redo
      eam.enableAction(EditorActionManager.RDO_A_P,
          getUndoManager().canRedo());
      // Enable/disable undo
      eam.enableAction(EditorActionManager.UDO_A_AP,
          getUndoManager().canUndo());
    }
  }