SocietyComponent societyCopy = (SocietyComponent)society.copy(newName);          if (societyCopy instanceof SocietyComponent) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)findNode(society).getParent(); workspace.setSelection(addSocietyToWorkspace(societyCopy, node)); } else societyNames.add(newName);
final SocietyComponent societyCopy = (SocietyComponent)society.copy(newName);  GUIUtils.timeConsumingTaskStart(organizer); try { new Thread("DuplicateRecipe") { public void run() { societyCopy.saveToDatabase(); GUIUtils.timeConsumingTaskEnd(organizer); } }.start(); } catch (RuntimeException re) { if(log.isErrorEnabled()) { log.error("Runtime exception duplicating society", re); } GUIUtils.timeConsumingTaskEnd(organizer); } DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode)getSelectedNode().getParent(); if (isSelectedNodeInExperiment()) addSocietyToWorkspace(societyCopy, (DefaultMutableTreeNode)parentNode.getParent()); else addSocietyToWorkspace(societyCopy, parentNode);
  public SocietyComponent copySociety(SocietyComponent society) {    // FIXME: When societies are added back in, this will need to    // be modified so that they are saved in the database.  See    // copyRecipe() for an example.    String newName = generateSocietyName(society.getSocietyName());    SocietyComponent societyCopy = (SocietyComponent)society.copy(newName);//      boolean builtIn = false;//      for (int i = 0; i < builtInSocieties.length; i++) //        if (builtInSocieties[i].cls.isInstance(societyCopy)) {//          builtIn = true;//          break;//        }    // add society to workspace only if it's builtin    //    if (builtIn) {    if (societyCopy instanceof SocietyComponent) {      DefaultMutableTreeNode node =         (DefaultMutableTreeNode)findNode(society).getParent();      workspace.setSelection(addSocietyToWorkspace(societyCopy, node));    } else      societyNames.add(newName);    return societyCopy;  }