MetricComponent mc = createMet(name, item.cls); if (mc == null) return; DefaultMutableTreeNode newNode = addMetricToWorkspace(mc, node); workspace.setSelection(newNode);
  private void newMetric(DefaultMutableTreeNode node) {    Object[] values = metComboItems;    Object answer =      JOptionPane.showInputDialog(this, "Select Metric Type",				  "Select Metric",				  JOptionPane.QUESTION_MESSAGE,				  null,				  values,				  "Empty Metric");				  //"Mo Metric");    if (answer instanceof ComboItem) {      ComboItem item = (ComboItem) answer;      String name = metricNames.generateName(item.name);      while (true) {	name = (String) JOptionPane.showInputDialog(this, "Enter Metric Name",						    "Name Metric",						    JOptionPane.QUESTION_MESSAGE,						    null, null,						    name);	if (name == null) return;	if (!metricNames.contains(name)) break;	int ok = JOptionPane.showConfirmDialog(this,					       "Use an unique name",					       "Metric Name Not Unique",					       JOptionPane.OK_CANCEL_OPTION,					       JOptionPane.ERROR_MESSAGE);	if (ok != JOptionPane.OK_OPTION) return;      }      try {	Constructor constructor = item.cls.getConstructor(constructorArgTypes);// 	Metric metric =// 	  (Metric) constructor.newInstance(new String[] {name});	MetricComponent metric =		  (MetricComponent) constructor.newInstance(new String[] {name});	DefaultMutableTreeNode newNode =	  addMetricToWorkspace(metric, node);	workspace.setSelection(newNode);      } catch (Exception e) {	e.printStackTrace();      }      MetricComponent mc = createMet(name, item.cls);      if (mc == null)	return;      DefaultMutableTreeNode newNode =	addMetricToWorkspace(mc, node);      workspace.setSelection(newNode);    }  } // end of newMetric