societyNames.remove(society.getSocietyName());
  protected void deleteSocietyInNode(DefaultMutableTreeNode societyNode) {    SocietyComponent society = (SocietyComponent)societyNode.getUserObject();    if (!society.isEditable()) {      int result = JOptionPane.showConfirmDialog(this,						 "Society has been or is being used; delete anyway?",						 "Society Not Editable",						 JOptionPane.YES_NO_OPTION,						 JOptionPane.WARNING_MESSAGE);      if (result != JOptionPane.YES_OPTION)	return;    }    model.removeNodeFromParent(societyNode);//      int result =//        JOptionPane.showConfirmDialog(this,//                                      "Delete society " +//                                      society.getSocietyName() +//                                      " from all experiments?",//                                      "Delete Society",//                                      JOptionPane.YES_NO_OPTION,//                                      JOptionPane.WARNING_MESSAGE);//      if (result == JOptionPane.NO_OPTION) {//        return; // just delete this node//      }//      // delete society from all experiments in the workspace//      // and warn user to resave them//      displayExperimentsInWorkspace(society);//      ArrayList nodesToDelete = new ArrayList();//      Enumeration nodes = root.depthFirstEnumeration(); //      while (nodes.hasMoreElements()) {//        DefaultMutableTreeNode node = //          (DefaultMutableTreeNode)nodes.nextElement();//        Object o = node.getUserObject();//        if (o instanceof Experiment) {//          Experiment exp = (Experiment)o;//          if (exp.getSocietyComponent().equals(society))//            exp.removeSocietyComponent();//        } else if (society.equals(o)) {//          nodesToDelete.add(node);//        }//      }//      // remove nodes containing this society//      for (int i = 0; i < nodesToDelete.size(); i++)//        model.removeNodeFromParent((DefaultMutableTreeNode)nodesToDelete.get(i));    // if deleted last reference to society in the workspace    // ask if society should be deleted from database and delete it    if (findNodeNamed(society.getSocietyName()) != null)        return;    int answer =      JOptionPane.showConfirmDialog(this,                                    "Delete society " +                                    society.getSocietyName() +                                    " from database?",                                    "Delete Society",                                    JOptionPane.YES_NO_OPTION);    if (answer == JOptionPane.YES_OPTION) {      try {	// Will only actually do the delete	// if no-one uses it	PopulateDb.deleteSociety(society.getAssemblyId());      } catch (Exception e) {	if (log.isErrorEnabled()) {	  log.error("Exception deleting society " + society.getSocietyName() + " from db", e);	}      }    }    societyNames.remove(society.getSocietyName());  }