if (root == null) root = new DefaultMutableTreeNode(); String rootName = f.getName(); int extpos = rootName.lastIndexOf('.'); if (extpos >= 0) rootName = rootName.substring(0, extpos); root.setUserObject(rootName);  model = createModel(this, root); Class[] noTypes = new Class[0]; try { societyNames.init(getLeaves(SocietyComponent.class, root), SocietyComponent.class.getMethod("getSocietyName", noTypes)); experimentNames.init(getLeaves(Experiment.class, root), Experiment.class.getMethod("getExperimentName", noTypes)); impactNames.init(getLeaves(ImpactComponent.class, root), ImpactComponent.class.getMethod("getImpactName", noTypes)); metricNames.init(getLeaves(Metric.class, root), Metric.class.getMethod("getName", noTypes)); return; } catch (NoSuchMethodException nsme) { nsme.printStackTrace(); } catch (SecurityException se) { se.printStackTrace(); } } catch (Exception ioe) { ioe.printStackTrace(); return; }
} } catch (Exception e) { System.out.println("Organizer: can't read file: " + f); } finally { ois.close(); } } if (root == null) root = new DefaultMutableTreeNode(); String rootName = f.getName(); int extpos = rootName.lastIndexOf('.'); if (extpos >= 0) rootName = rootName.substring(0, extpos); root.setUserObject(rootName);  model = createModel(this, root); Class[] noTypes = new Class[0]; try { societyNames.init(getLeaves(SocietyComponent.class, root), SocietyComponent.class.getMethod("getSocietyName", noTypes)); experimentNames.init(getLeaves(Experiment.class, root), Experiment.class.getMethod("getExperimentName", noTypes)); impactNames.init(getLeaves(ImpactComponent.class, root), ImpactComponent.class.getMethod("getImpactName", noTypes)); metricNames.init(getLeaves(Metric.class, root), Metric.class.getMethod("getName", noTypes)); componentNames.init(getLeaves(ModifiableConfigurableComponent.class, root), ModifiableConfigurableComponent.class.getMethod("getShortName", noTypes)); return; } catch (NoSuchMethodException nsme) { nsme.printStackTrace(); } catch (SecurityException se) { se.printStackTrace(); } } catch (Exception ioe) { ioe.printStackTrace(); return;
    private void restore(String fileName) {        PropertyListener l = null;        try {            File f = new File(fileName);	    this.workspaceFileName = f.getPath();            if (f.canRead()) {                ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f));                try {                    root = (DefaultMutableTreeNode) ois.readObject();                    for (Enumeration e = root.depthFirstEnumeration();                         e.hasMoreElements(); ) {                        DefaultMutableTreeNode node =                            (DefaultMutableTreeNode) e.nextElement();                        Object o = node.getUserObject();                        if (o instanceof SocietyComponent) {                            installListeners((SocietyComponent) o);                        } else if (o instanceof Experiment)			  ((Experiment)o).addModificationListener(myModificationListener);                    }		} catch (Exception e) {		  System.out.println("Organizer: can't read file: " + f);                } finally {                    ois.close();		} 	  	    }	    if (root == null)	      root = new DefaultMutableTreeNode();            String rootName = f.getName();            int extpos = rootName.lastIndexOf('.');            if (extpos >= 0)                 rootName = rootName.substring(0, extpos);            root.setUserObject(rootName);	    //            model = new DefaultTreeModel(root);            model = createModel(this, root);            Class[] noTypes = new Class[0];            try {                societyNames.init(getLeaves(SocietyComponent.class, root),                                  SocietyComponent.class.getMethod("getSocietyName", noTypes));                experimentNames.init(getLeaves(Experiment.class, root),                                     Experiment.class.getMethod("getExperimentName", noTypes));                impactNames.init(getLeaves(ImpactComponent.class, root),                                 ImpactComponent.class.getMethod("getImpactName", noTypes));                metricNames.init(getLeaves(Metric.class, root),                                 Metric.class.getMethod("getName", noTypes));                return;            } catch (NoSuchMethodException nsme) {                nsme.printStackTrace();            } catch (SecurityException se) {                se.printStackTrace();            }        } catch (Exception ioe) {            ioe.printStackTrace();            return;        }    }