コード例 #1
0
  public void renameFlameBtn_clicked() {
    try {
      Flame flame = poolFlameHolder.getFlame();
      if (flame != null) {
        int idx = flamePropertiesTree.getSelectionRows()[0];
        String s =
            StandardDialogs.promptForText(
                rootTabbedPane, "Please enter the new title:", flame.getName());
        if (s != null) {
          for (Flame tFlame : project.getFlames()) {
            if (!tFlame.isEqual(flame) && s.equals(tFlame.getName())) {
              throw new RuntimeException(
                  "A different flame with the name \"" + s + "\" alread exists");
            }
          }
          flame.setName(s);
          refreshProjectFlames();
          if (project.getFlames().size() == 0) {
            flamePropertiesTree_changed(null);
          } else {
            try {
              flamePropertiesTree.setSelectionRow(idx);
            } catch (Exception ex) {

            }
          }
          enableControls();
        }
      }
    } catch (Exception ex) {
      errorHandler.handleError(ex);
    }
  }
コード例 #2
0
 public void renameMotionBtn_clicked() {
   int row = motionTable.getSelectedRow();
   if (row >= 0 && row < project.getMotions().size()) {
     Motion motion = project.getMotions().get(row);
     String s =
         StandardDialogs.promptForText(
             rootTabbedPane, "Please enter the new title:", motion.getDisplayLabel());
     if (s != null) {
       motion.setCaption(s);
       refreshMotionTable();
       if (row >= project.getMotions().size()) {
         row--;
       }
       if (row >= 0) {
         motionTable.getSelectionModel().setSelectionInterval(row, row);
       }
       motionTableClicked();
       enableControls();
     }
   }
 }