action.setEnabled(isActionAllowedOnExperiment(s, organizer,
action.setEnabled(isActionAllowedOnExperiment(action, organizer,
  public static void setActionAllowed(Action action,                                      Organizer organizer) {    String s = (String)action.getValue(Action.NAME);    DefaultMutableTreeNode selectedNode = organizer.getSelectedNode();    // If nothing is selected, some things are still legitimate    if (selectedNode == null) {      if (s.equals(DELETE_EXPERIMENT_FROM_DATABASE_ACTION) ||          s.equals(DELETE_RECIPE_FROM_DATABASE_ACTION)) {        action.setEnabled(true);        return;      } else {	action.setEnabled(false);        return;      }    }    // can't do anything with nodes in an experiment being edited or run    if (organizer.isNodeInUse(selectedNode)) {      action.setEnabled(false);      return;    }    // handle if selected object is root of workspace    if (selectedNode.isRoot()) {      if (s.equals(NEW_EXPERIMENT_ACTION) ||          s.equals(NEW_RECIPE_ACTION) ||          s.equals(NEW_FOLDER_ACTION) ||          s.equals(RENAME_ACTION) ||          s.equals(DELETE_EXPERIMENT_FROM_DATABASE_ACTION) ||          s.equals(DELETE_RECIPE_FROM_DATABASE_ACTION)) {        action.setEnabled(true);        return;      }      action.setEnabled(false);      return;    } // end handling root    Object selectedObject = selectedNode.getUserObject();    if (selectedObject instanceof String)       action.setEnabled(isActionAllowedOnFolder(s, organizer,                                                 organizer.getSelectedNode()));    else if (selectedObject instanceof Experiment)      action.setEnabled(isActionAllowedOnExperiment(s, organizer,                                       (Experiment)selectedObject));    else if (selectedObject instanceof SocietyComponent)      action.setEnabled(isActionAllowedOnSociety(s, organizer,                                   (SocietyComponent)selectedObject));    else if (selectedObject instanceof RecipeComponent)      action.setEnabled(isActionAllowedOnRecipe(s, organizer,                            (RecipeComponent)selectedObject));    else {      System.out.println("ActionUtil: unhandled case: " + s);      action.setEnabled(false);    }    return;  }