final DefaultMutableTreeNode experimentNode = node; final Experiment newExperiment = experiment; final java.awt.Component glass = ((JFrame)SwingUtilities.getRoot(this)).getGlassPane(); final java.awt.Component c = this; try { SwingUtilities.invokeLater(new Runnable() { public void run() { DefaultMutableTreeNode newNode = addExperimentToWorkspace(newExperiment, experimentNode); workspace.setSelection(newNode);  GUIUtils.timeConsumingTaskEnd(c); } }); } catch (RuntimeException e) { System.err.println(e); e.printStackTrace(); }
workspace.setSelection(addExperimentToWorkspace(experiment, node));
  private void createCMTExperiment(DefaultMutableTreeNode node,                                   String experimentName,                                   String experimentId,                                   String trialId,                                   boolean isCloned) {    //    System.out.println("Creating society");    // get assembly ids for trial    ArrayList assemblyIds = getTrialAssemblyIds(experimentId, trialId);    String assemblyMatch = getAssemblyMatch(assemblyIds);    // get nodes for trial    ArrayList nodes = getNodes(trialId, assemblyMatch);    ArrayList hosts = getHosts(trialId, assemblyMatch);    CMTSociety soc = null;    if (assemblyIds.size() != 0) {      soc = new CMTSociety(assemblyIds);            soc.initProperties();    } else { // We need to create a new trial.      // Need to have the experiment id, trial id, and multiplicity      // for the call that will generate the assembly here.      System.out.println("No assemblies for: " + experimentId + " " + trialId);      return; // creating an experiment from scratch not implemented yet    }    Experiment experiment = new Experiment((String)experimentName,                                            experimentId, trialId);    experiment.setCloned(isCloned);    experiment.addSocietyComponent((SocietyComponent)soc);    // Add all Nodes.    addAgents(experiment, nodes, soc.getAgents(), trialId, assemblyMatch);    // Add all Hosts.    Iterator hostIter = hosts.iterator();    while (hostIter.hasNext()) {      experiment.addHost((String)hostIter.next());    }    mapNodesToHosts(experiment, assemblyMatch);    final DefaultMutableTreeNode experimentNode = node;    final Experiment newExperiment = experiment;    final java.awt.Component glass =       ((JFrame)SwingUtilities.getRoot(this)).getGlassPane();    final java.awt.Component c = this;    try {      SwingUtilities.invokeLater(new Runnable() {        public void run() {          DefaultMutableTreeNode newNode =            addExperimentToWorkspace(newExperiment, experimentNode);          workspace.setSelection(newNode);          // restore default cursor and allow input          GUIUtils.timeConsumingTaskEnd(c);        }      });    } catch (RuntimeException e) {      System.err.println(e);      e.printStackTrace();    }  }