String name = experimentNames.generateName(); while (true) { name = (String) JOptionPane.showInputDialog(this, "Enter Experiment Name", "Experiment Name", JOptionPane.QUESTION_MESSAGE, null, null, name); if (name == null) return null; if (!experimentNames.contains(name)) break; int answer = JOptionPane.showConfirmDialog(this, "Use an unique name", "Experiment Name Not Unique", JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE); if (answer != JOptionPane.OK_OPTION) return null; } try { Experiment experiment = new Experiment(name); DefaultMutableTreeNode newNode = addExperimentToWorkspace(experiment, node); workspace.setSelection(newNode); return newNode; } catch (Exception e) { e.printStackTrace(); return null; }
String name = experimentNames.generateName(); while (true) { name = (String) JOptionPane.showInputDialog(this, "Enter Experiment Name", "Experiment Name", JOptionPane.QUESTION_MESSAGE, null, null, name); if (name == null) return null; if (!experimentNames.contains(name)) break; int answer = JOptionPane.showConfirmDialog(this, "Use an unique name", "Experiment Name Not Unique", JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE); if (answer != JOptionPane.OK_OPTION) return null;
    private DefaultMutableTreeNode newExperiment(DefaultMutableTreeNode node) {        String name = experimentNames.generateName();        while (true) {            name = (String) JOptionPane.showInputDialog(this, "Enter Experiment Name",                                                        "Experiment Name",                                                        JOptionPane.QUESTION_MESSAGE,                                                        null, null,                                                        name);            if (name == null) return null;            if (!experimentNames.contains(name)) break;            int answer = JOptionPane.showConfirmDialog(this,                                                       "Use an unique name",                                                       "Experiment Name Not Unique",                                                       JOptionPane.OK_CANCEL_OPTION,                                                       JOptionPane.ERROR_MESSAGE);            if (answer != JOptionPane.OK_OPTION) return null;        }        try {            Experiment experiment = new Experiment(name);	    DefaultMutableTreeNode newNode =	      addExperimentToWorkspace(experiment, node);	    workspace.setSelection(newNode);	    return newNode;        } catch (Exception e) {            e.printStackTrace();	    return null;        }    }