/*-------------------------------------------------------------------------*/
 public void renameItem(String newName) {
   SwingEditor.instance.setDirty(SwingEditor.Tab.DIFFICULTY_LEVELS);
   DifficultyLevel current =
       Database.getInstance().getDifficultyLevels().get((String) names.getSelectedValue());
   Database.getInstance().getDifficultyLevels().remove(current.getName());
   current.setName(newName);
   Database.getInstance().getDifficultyLevels().put(current.getName(), current);
   refreshNames(newName);
 }
  /*-------------------------------------------------------------------------*/
  public void copyItem(String newName) {
    SwingEditor.instance.setDirty(SwingEditor.Tab.DIFFICULTY_LEVELS);
    DifficultyLevel current =
        Database.getInstance().getDifficultyLevels().get((String) names.getSelectedValue());

    try {
      DifficultyLevel dl = current.getClass().newInstance();
      dl.setName(newName);
      Database.getInstance().getDifficultyLevels().put(dl.getName(), dl);
      refreshNames(newName);
    } catch (Exception x) {
      throw new MazeException(x);
    }
  }
  /*-------------------------------------------------------------------------*/
  public void commit(String name) {
    // custom impls only supported
    if (name == null) {
      return;
    }

    Map<String, DifficultyLevel> difficultyLevels = Database.getInstance().getDifficultyLevels();

    try {
      Class clazz = Class.forName(impl.getText());
      DifficultyLevel dl = (DifficultyLevel) clazz.newInstance();
      dl.setName(name);
      dl.setSortOrder((Integer) sortOrder.getValue());
      difficultyLevels.put(name, dl);
    } catch (Exception x) {
      throw new MazeException(x);
    }
  }