if (action.equals(organizer.runExperimentAction)) { action.setEnabled(true); return; }
  public static void setActionAllowed(Action action,                                      Organizer organizer) {    Logger log = CSMART.createLogger("org.cougaar.tools.csmart.ui.viewer.ActionUtil");    DefaultMutableTreeNode selectedNode = organizer.getSelectedNode();    // If nothing is selected, some things are still legitimate    if (selectedNode == null) {      if (action.equals(organizer.deleteExperimentFromDatabaseAction) ||          action.equals(organizer.deleteRecipeFromDatabaseAction)) {        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 (action.equals(organizer.newExperimentFromDBAction) ||          action.equals(organizer.newExperimentFromFileAction) ||          action.equals(organizer.newExperimentFromUIAction) ||          action.equals(organizer.newFolderAction) ||          action.equals(organizer.renameAction) ||          action.equals(organizer.renameWorkspaceAction) ||          action.equals(organizer.newRecipeFromDatabaseAction) ||          action.equals(organizer.newRecipeBuiltInAction) ||          action.equals(organizer.deleteExperimentFromDatabaseAction) ||          action.equals(organizer.deleteRecipeFromDatabaseAction)) {        action.setEnabled(true);        return;      }      action.setEnabled(false);      return;    } // end handling root    Object selectedObject = selectedNode.getUserObject();    if (selectedObject instanceof String)       action.setEnabled(isActionAllowedOnFolder(action, organizer,                                                 organizer.getSelectedNode()));    else if (selectedObject instanceof Experiment)      action.setEnabled(isActionAllowedOnExperiment(action, organizer,                                       (Experiment)selectedObject));    else if (selectedObject instanceof SocietyComponent)      action.setEnabled(isActionAllowedOnSociety(action, organizer,                                   (SocietyComponent)selectedObject));    else if (selectedObject instanceof RecipeComponent)      action.setEnabled(isActionAllowedOnRecipe(action, organizer,                            (RecipeComponent)selectedObject));    else {      if(log.isErrorEnabled()) {        log.error("ActionUtil: unhandled case: " +                  (String)action.getValue(Action.NAME));      }      action.setEnabled(false);    }    return;  }