recipe.setName(newName); GUIUtils.timeConsumingTaskStart(organizer); try { new Thread("SaveRecipe") { public void run() { recipe.saveToDatabase(); GUIUtils.timeConsumingTaskEnd(organizer); } }.start(); } catch (RuntimeException re) { if(log.isErrorEnabled()) { log.error("Runtime exception saving recipe", re);
Object o = parentNode.getUserObject(); if (o instanceof Experiment) { Experiment experiment = (Experiment)o; model.removeNodeFromParent(node); experiment.removeRecipeComponent(recipe); RecipeComponent recipeCopy = (RecipeComponent)recipe.copy(newName); experiment.addRecipeComponent(recipeCopy); recipeCopy.saveToDatabase(); addRecipeToWorkspace(recipeCopy, parentNode); } else { recipeNames.add(newName); recipe.setName(newName); recipe.saveToDatabase(); Enumeration nodes = root.depthFirstEnumeration(); while (nodes.hasMoreElements()) { node = (DefaultMutableTreeNode)nodes.nextElement(); if (node.getUserObject().equals(recipe)) model.nodeChanged(node);
  public void renameRecipe() {    DefaultMutableTreeNode node = getSelectedNode();    final RecipeComponent recipe = (RecipeComponent) node.getUserObject();    String originalName = recipe.getRecipeName();    String newName = getUniqueRecipeName(originalName, true);    if (newName == null)      return;    if (newName.equals(originalName))      return;    recipeNames.remove(originalName);    recipe.setName(newName);    GUIUtils.timeConsumingTaskStart(organizer);    try {      new Thread("SaveRecipe") {          public void run() {            recipe.saveToDatabase();            GUIUtils.timeConsumingTaskEnd(organizer);          }        }.start();    } catch (RuntimeException re) {      if(log.isErrorEnabled()) {        log.error("Runtime exception saving recipe", re);      }      GUIUtils.timeConsumingTaskEnd(organizer);    }    recipeNames.add(newName);    model.nodeChanged(node); // update the model...  }