/*.................................................................................................................*/
  public Tree retrieveTreeBlock(TreeVector treeList, MesquiteDouble finalScore) {
    logln("Preparing to receive TNT trees.");
    boolean success = false;
    taxa = treeList.getTaxa();
    // TODO		finalScore.setValue(finalValue);

    suppressProjectPanelReset();
    CommandRecord oldCR = MesquiteThread.getCurrentCommandRecord();
    CommandRecord scr = new CommandRecord(true);
    MesquiteThread.setCurrentCommandRecord(scr);

    // define file paths and set tree files as needed.
    setFileNames();
    String[] outputFilePaths = externalProcRunner.getOutputFilePaths();

    String treeFilePath = outputFilePaths[OUT_TREEFILE];
    taxonNumberTranslation = getTaxonNumberTranslation(taxa);
    namer.setNumberTranslationTable(taxonNumberTranslation);

    runFilesAvailable();

    // read in the tree files
    success = false;
    Tree t = null;

    MesquiteBoolean readSuccess = new MesquiteBoolean(false);
    // TreeVector tv = new TreeVector(taxa);
    if (bootstrapOrJackknife()) {
      if (resamplingAllConsensusTrees)
        t =
            ZephyrUtil.readTNTTreeFile(
                this,
                treeList,
                taxa,
                treeFilePath,
                "TNT " + getResamplingKindName() + " Rep",
                0,
                readSuccess,
                false,
                false,
                null,
                namer); // set first tree number as 0 as will remove the first one later.
      else
        t =
            ZephyrUtil.readTNTTreeFile(
                this,
                treeList,
                taxa,
                treeFilePath,
                "TNT " + getResamplingKindName() + " Majority Rule Tree",
                1,
                readSuccess,
                false,
                false,
                freqRef,
                namer);
    } else
      t =
          ZephyrUtil.readTNTTreeFile(
              this,
              treeList,
              taxa,
              treeFilePath,
              "TNTTree",
              1,
              readSuccess,
              false,
              harvestOnlyStrictConsensus,
              null,
              namer);
    success = t != null;
    if (success && bootstrapOrJackknife() && resamplingAllConsensusTrees) {
      t = t.cloneTree();
      treeList.removeElementAt(0, false); // get rid of first one as this is the bootstrap tree
    }

    MesquiteThread.setCurrentCommandRecord(oldCR);
    success = readSuccess.getValue();
    if (!success) {
      logln("Execution of TNT unsuccessful [2]");
      if (!beanWritten) postBean("unsuccessful [2]", false);
      beanWritten = true;
    } else {
      if (!beanWritten) postBean("successful", false);
      beanWritten = true;
    }

    desuppressProjectPanelReset();
    if (data != null) data.decrementEditInhibition();
    //	manager.deleteElement(tv);  // get rid of temporary tree block
    externalProcRunner.finalCleanup();
    if (success) return t;
    return null;
  }
  public boolean queryOptions() {
    if (!okToInteractWithUser(
        CAN_PROCEED_ANYWAY,
        "Querying Options")) // Debugg.println needs to check that options set well enough to
                             // proceed anyway
    return true;
    boolean closeWizard = false;

    if ((MesquiteTrunk.isMacOSXBeforeSnowLeopard()) && MesquiteDialog.currentWizard == null) {
      CommandRecord cRec = null;
      cRec = MesquiteThread.getCurrentCommandRecordDefIfNull(null);
      if (cRec != null) {
        cRec.requestEstablishWizard(true);
        closeWizard = true;
      }
    }

    MesquiteInteger buttonPressed = new MesquiteInteger(1);

    queryOptionsDialog =
        new ExtensibleDialog(
            containerOfModule(),
            "TNT Options & Locations",
            buttonPressed); // MesquiteTrunk.mesquiteTrunk.containerOfModule()
    //		queryOptionsDialog.addLabel("TNT - Options and Locations");
    String helpString =
        "This module will prepare a matrix for TNT, and ask TNT do to an analysis.  A command-line version of TNT must be installed. "
            + "You can ask it to do a bootstrap analysis or not. "
            + "Mesquite will read in the trees found by TNT. ";

    queryOptionsDialog.appendToHelpString(helpString);
    queryOptionsDialog.setHelpURL(zephyrRunnerEmployer.getProgramURL());

    MesquiteTabbedPanel tabbedPanel = queryOptionsDialog.addMesquiteTabbedPanel();

    tabbedPanel.addPanel("TNT Program Details", true);
    externalProcRunner.addItemsToDialogPanel(queryOptionsDialog);
    Checkbox parallelCheckBox =
        queryOptionsDialog.addCheckBox("use PVM for parallel processing", parallel);
    parallelCheckBox.addItemListener(this);
    IntegerField slavesField =
        queryOptionsDialog.addIntegerField(
            "Number of Slaves", numSlaves, 4, 0, MesquiteInteger.infinite);
    IntegerField maxRamField =
        queryOptionsDialog.addIntegerField("mxram value", mxram, 4, 0, MesquiteInteger.infinite);

    tabbedPanel.addPanel("Search Options", true);
    Choice searchStyleChoice = null;
    if (bootstrapAllowed)
      searchStyleChoice =
          queryOptionsDialog.addPopUpMenu(
              "Type of search/resampling:",
              new String[] {
                "Regular Search",
                "Bootstrap",
                "Jackknife",
                "Symmetric Resampled",
                "Poisson Bootstrap"
              },
              searchStyle);
    queryOptionsDialog.addLabel("Regular Search Commands");
    searchField = queryOptionsDialog.addTextAreaSmallFont(searchArguments, 7, 80);
    searchScriptPathField =
        queryOptionsDialog.addTextField(
            "Path to TNT run file containing search commands", searchScriptPath, 40);
    Button browseSearchScriptPathButton =
        queryOptionsDialog.addAListenedButton("Browse...", null, this);
    browseSearchScriptPathButton.setActionCommand("browseSearchScript");
    harvestOnlyStrictConsensusBox =
        queryOptionsDialog.addCheckBox("only acquire strict consensus", harvestOnlyStrictConsensus);
    queryOptionsDialog.addHorizontalLine(1);
    //		Checkbox doBootstrapBox = queryOptionsDialog.addCheckBox("do bootstrapping", doBootstrap);
    if (bootstrapAllowed) {
      bootStrapRepsField =
          queryOptionsDialog.addIntegerField(
              "Resampling Replicates", bootstrapreps, 8, 0, MesquiteInteger.infinite);
      queryOptionsDialog.addLabel("Resampling Search Commands");
      bootstrapSearchField =
          queryOptionsDialog.addTextAreaSmallFont(bootstrapSearchArguments, 7, 80);
      bootSearchScriptPathField =
          queryOptionsDialog.addTextField(
              "Path to TNT run file containing search commands for resampled",
              bootSearchScriptPath,
              30);
      Button browseBootSearchScriptPathButton =
          queryOptionsDialog.addAListenedButton("Browse...", null, this);
      browseSearchScriptPathButton.setActionCommand("browseBootSearchScript");
      resamplingAllConsensusTreesBox =
          queryOptionsDialog.addCheckBox(
              "allow TNT to calculate consensus tree", !resamplingAllConsensusTrees);
    }

    adjustDialogText();
    queryOptionsDialog.addHorizontalLine(1);
    queryOptionsDialog.addNewDialogPanel();
    useDefaultsButton = queryOptionsDialog.addAListenedButton("Set to Defaults", null, this);
    useDefaultsButton.setActionCommand("setToDefaults");

    tabbedPanel.addPanel("Other Options", true);
    convertGapsBox =
        queryOptionsDialog.addCheckBox(
            "convert gaps to missing (to avoid gap=extra state)", convertGapsToMissing);
    queryOptionsDialog.addHorizontalLine(1);
    queryOptionsDialog.addLabel("Post-Search TNT Commands");
    otherOptionsField = queryOptionsDialog.addTextAreaSmallFont(otherOptions, 7, 80);
    queryOptionsDialog.addHorizontalLine(1);
    queryOptionsDialog.addNewDialogPanel();
    useDefaultsOtherOptionsButton =
        queryOptionsDialog.addAListenedButton("Set to Defaults", null, this);
    useDefaultsOtherOptionsButton.setActionCommand("setToDefaultsOtherOptions");

    tabbedPanel.cleanup();
    queryOptionsDialog.nullifyAddPanel();

    queryOptionsDialog.completeAndShowDialog("Search", "Cancel", null, null);

    if (buttonPressed.getValue() == 0) {
      boolean infererOK = (treeInferer == null || treeInferer.optionsChosen());
      if (externalProcRunner.optionsChosen() && infererOK) {
        if (bootstrapAllowed) {
          bootstrapreps = bootStrapRepsField.getValue();
          bootstrapSearchArguments = bootstrapSearchField.getText();
          bootSearchScriptPath = bootSearchScriptPathField.getText();
          harvestOnlyStrictConsensus = harvestOnlyStrictConsensusBox.getState();
          resamplingAllConsensusTrees = !resamplingAllConsensusTreesBox.getState();
          searchStyle = searchStyleChoice.getSelectedIndex();
        }
        numSlaves = slavesField.getValue();
        otherOptions = otherOptionsField.getText();
        convertGapsToMissing = convertGapsBox.getState();
        parallel = parallelCheckBox.getState();
        //				doBootstrap = doBootstrapBox.getState();
        searchArguments = searchField.getText();
        searchScriptPath = searchScriptPathField.getText();
        mxram = maxRamField.getValue();

        storeRunnerPreferences();
      }
    }
    queryOptionsDialog.dispose();
    if (closeWizard) MesquiteDialog.closeWizard();

    return (buttonPressed.getValue() == 0);
  }