@Action
  public void addPuzles() {
    // Get the active collection
    ConstraintPuzzleCollectionPanel selectedPanel = SudokuApplication.getApplication().getApplicationView().getSelectedCollectionPanel();
    if (selectedPanel == null) {
      // Not on a collection panel...
      return;
    }

    ConstraintPuzzleCollection selectedCollection = selectedPanel.getCollection();

    if (selectedCollection != null) {
      int numberOfPuzzlesToAdd;

      try {
        numberOfPuzzlesToAdd = Integer.parseInt(numberOfPuzzlesTextField.getText());
      } catch (NumberFormatException e) {
        JOptionPane.showMessageDialog(this, "Number Of Puzzles must be numeric.", "Non-Numeric Data", JOptionPane.ERROR_MESSAGE);
        numberOfPuzzlesTextField.selectAll();
        numberOfPuzzlesTextField.requestFocus();
        return;
      }

      int maximumNumberOfFailuresInARow = 25; // Crude failure detection
      int numberOfPuzzlesGenerated = 0;
      int numberOfSuccessiveFailures = 0;
      while (numberOfPuzzlesGenerated < numberOfPuzzlesToAdd) {
        if (numberOfSuccessiveFailures == maximumNumberOfFailuresInARow) {
          // If we've failed too much...
          JOptionPane.showMessageDialog(this, "Unable to generate puzzles.", "We've Failed Too Much, Man!", JOptionPane.ERROR_MESSAGE);
          return; // Void
        } else {
          // try {
          ConstraintPuzzle newPuzzleSolution = null;
          try {
            newPuzzleSolution = (ConstraintPuzzle) selectedCollection.getPuzzleClass().newInstance();
          } catch (Exception e) {
          }

          newPuzzleSolution.setSize(9);
          newPuzzleSolution.setRuleset(selectedCollection.getRuleset());
          newPuzzleSolution.solveWithBacktracking(true);

          //     System.out.println("Making new puzzle");

          ConstraintPuzzle newPuzzle;

          // TODO here: FIX THIS IS AWFUL
          if (difficultyComboBox.getSelectedItem().toString().equals("Easy")) {
            newPuzzle = newPuzzleSolution.getNewStartState(Difficulty.EASY);
          } else if (difficultyComboBox.getSelectedItem().toString().equals("Medium")) {
            newPuzzle = newPuzzleSolution.getNewStartState(Difficulty.MEDIUM);
          } else {
            newPuzzle = newPuzzleSolution.getNewStartState(Difficulty.HARD);
          }

          if (newPuzzle == null) {
            numberOfSuccessiveFailures++;
            System.out.println("Failed.");
          } else {
            numberOfPuzzlesGenerated++;
            selectedCollection.addPuzzle(newPuzzle);
            numberOfSuccessiveFailures = 0;
          }
                        
                        /*
                    }
                    catch(Exception e) {
                       // throw new RuntimeException();
                        System.out.println("Exception in AddPuzzlesDialog: " + e.toString());
                    }*/
        }
      }
      selectedPanel.syncPanels();
      selectedPanel.repaint();

      SudokuApplication.getApplication().getApplicationView().saveSelectedPuzzleCollection();

      close();
    } else {
      System.out.println("GUI Error: AddPuzzlesDialog");
      // Throw an alert ?
    }
  }