diff --git a/Source/mesquite/Mesquite.java b/Source/mesquite/Mesquite.java index 6ce1350c6..71c3379de 100644 --- a/Source/mesquite/Mesquite.java +++ b/Source/mesquite/Mesquite.java @@ -38,20 +38,20 @@ public class Mesquite extends MesquiteTrunk { /*.................................................................................................................*/ public String getCitation() { - return "Maddison, W.P. & D.R. Maddison. 2017. Mesquite: A modular system for evolutionary analysis. Version 3.3. http://mesquiteproject.org"; + return "Maddison, W.P. & D.R. Maddison. 2017. Mesquite: A modular system for evolutionary analysis. Version 3.31. http://mesquiteproject.org"; } /*.................................................................................................................*/ public String getVersion() { - return "3.3"; + return "3.31"; } /*.................................................................................................................*/ public int getVersionInt() { - return 330; + return 331; } /*.................................................................................................................*/ public double getMesquiteVersionNumber(){ - return 3.3; + return 3.31; } /*.................................................................................................................*/ public String getDateReleased() { diff --git a/Source/mesquite/align/ClustalAlign/ClustalAlign.java b/Source/mesquite/align/ClustalAlign/ClustalAlign.java index 1cbfbdfd5..84ed22f89 100644 --- a/Source/mesquite/align/ClustalAlign/ClustalAlign.java +++ b/Source/mesquite/align/ClustalAlign/ClustalAlign.java @@ -90,11 +90,14 @@ public String getDefaultProgramOptions(){ } public void appendDefaultOptions(StringBuffer shellScript, String inFilePath, String outFilePath, MolecularData data) { - shellScript.append(" -infile=" + StringUtil.protectFilePathForUnix(inFilePath) + " -align -output=pir "); - if (data instanceof ProteinData) - shellScript.append("-type=protein "); - else - shellScript.append("-type=dna "); + shellScript.append(" -infile=" + StringUtil.protectFilePathForUnix(inFilePath) + " -align -output=pir "); + if (data instanceof ProteinData) + shellScript.append("-type=protein "); + else + shellScript.append("-type=dna "); + if (scriptBased) + shellScript.append("-outfile="+StringUtil.protectFilePathForUnix(outFilePath)); + } diff --git a/Source/mesquite/align/MAFFTAlign/MAFFTAlign.java b/Source/mesquite/align/MAFFTAlign/MAFFTAlign.java index 794d4c741..513929552 100644 --- a/Source/mesquite/align/MAFFTAlign/MAFFTAlign.java +++ b/Source/mesquite/align/MAFFTAlign/MAFFTAlign.java @@ -230,7 +230,10 @@ public String getDefaultProgramOptions(){ } public void appendDefaultOptions(StringBuffer shellScript, String inFilePath, String outFilePath, MolecularData data) { - shellScript.append(" " + StringUtil.protectFilePathForUnix(inFilePath)); + if (scriptBased) + shellScript.append(" " + StringUtil.protectFilePathForUnix(inFilePath) + " > " + outFilePath); + else + shellScript.append(" " + StringUtil.protectFilePathForUnix(inFilePath)); } public String getDNAExportInterpreter () { diff --git a/Source/mesquite/align/MuscleAlign/MuscleAlign.java b/Source/mesquite/align/MuscleAlign/MuscleAlign.java index ce668c06a..759fd5979 100644 --- a/Source/mesquite/align/MuscleAlign/MuscleAlign.java +++ b/Source/mesquite/align/MuscleAlign/MuscleAlign.java @@ -88,7 +88,10 @@ public String getDefaultProgramOptions(){ } public void appendDefaultOptions(StringBuffer shellScript, String inFilePath, String outFilePath, MolecularData data) { - shellScript.append(" -in " + StringUtil.protectFilePathForUnix(inFilePath)); + if (scriptBased) + shellScript.append(" -in " + StringUtil.protectFilePathForUnix(inFilePath)+" -out " + StringUtil.protectFilePathForUnix(outFilePath)); + else + shellScript.append(" -in " + StringUtil.protectFilePathForUnix(inFilePath)); } public String getDNAExportInterpreter () { diff --git a/Source/mesquite/align/lib/ExternalSequenceAligner.java b/Source/mesquite/align/lib/ExternalSequenceAligner.java index a6e4e0c74..5afd3bc5f 100644 --- a/Source/mesquite/align/lib/ExternalSequenceAligner.java +++ b/Source/mesquite/align/lib/ExternalSequenceAligner.java @@ -36,14 +36,16 @@ public abstract class ExternalSequenceAligner extends MultipleSequenceAligner im boolean includeGaps = false; String programOptions = "" ; Random rng; + protected boolean scriptBased = false; public static int runs = 0; - //ShellScriptRunner scriptRunner; + ShellScriptRunner scriptRunner; ExternalProcessManager externalRunner; /*.................................................................................................................*/ public boolean startJob(String arguments, Object condition, boolean hiredByName) { rng = new Random(System.currentTimeMillis()); programOptions = getDefaultProgramOptions(); loadPreferences(); + scriptBased = MesquiteTrunk.isJavaVersionLessThan(1.7); return true; } public abstract String getProgramCommand(); @@ -59,16 +61,25 @@ public boolean startJob(String arguments, Object condition, boolean hiredByName) /*.................................................................................................................*/ public String getStdErr() { - if (externalRunner!=null) + if (scriptBased){ + if (scriptRunner!=null) + return scriptRunner.getStdErr(); + } + else if (externalRunner!=null) return externalRunner.getStdErr(); return ""; } /*.................................................................................................................*/ public String getStdOut() { - if (externalRunner!=null) + if (scriptBased){ + if (scriptRunner!=null) + return scriptRunner.getStdOut(); + } + else if (externalRunner!=null) return externalRunner.getStdOut(); return ""; } + public boolean userAborted(){ return false; } @@ -77,9 +88,13 @@ public String checkStatus(){ return null; } public boolean stopExecution(){ - if (externalRunner!=null) + if (scriptBased){ + if (scriptRunner!=null) + scriptRunner.stopExecution(); + } + else if (externalRunner!=null) { externalRunner.stopExecution(); - //scriptRunner = null; + } return false; } @@ -343,10 +358,11 @@ else if (!(firstTaxon==0 && lastTaxon==matrix.getNumTaxa())) { // we are doing argumentsForLogging.append(" " + programOptions + " "+ getQueryProgramOptions()); } shellScript.append(StringUtil.lineEnding()); -// shellScript.append(ShellScriptUtil.getRemoveCommand(runningFilePath)); + shellScript.append(ShellScriptUtil.getRemoveCommand(runningFilePath)); String scriptPath = rootDir + "alignerScript" + MesquiteFile.massageStringToFilePathSafe(unique) + ".bat"; - MesquiteFile.putFileContents(scriptPath, shellScript.toString(), false); + if (scriptBased) + MesquiteFile.putFileContents(scriptPath, shellScript.toString(), false); logln("Requesting the operating system to run " + getProgramName()); logln("Location of " + getProgramName()+ ": " + getProgramPath()); @@ -357,22 +373,22 @@ else if (!(firstTaxon==0 && lastTaxon==matrix.getNumTaxa())) { // we are doing ProgressIndicator progressIndicator = new ProgressIndicator(getProject(), getProgramName()+" alignment in progress"); progressIndicator.start(); - -/* scriptRunner = new ShellScriptRunner(scriptPath, runningFilePath, null, true, getName(), outputFilePaths, this, this, false); //scriptPath, runningFilePath, null, true, name, outputFilePaths, outputFileProcessor, watcher, true - success = scriptRunner.executeInShell(); - success = scriptRunner.monitorAndCleanUpShell(progressIndicator); -*/ - - String arguments = argumentsForLogging.toString(); - - arguments=StringUtil.stripBoundingWhitespace(arguments); - externalRunner = new ExternalProcessManager(this, rootDir, getProgramPath(), arguments,getName(), outputFilePaths, this, this, true); - //ShellScriptUtil.changeDirectory(rootDir, rootDir); - externalRunner.setStdOutFileName(outFileName); - success = externalRunner.executeInShell(); - if (success) - success = externalRunner.monitorAndCleanUpShell(progressIndicator); - + if (scriptBased) { + scriptRunner = new ShellScriptRunner(scriptPath, runningFilePath, null, true, getName(), outputFilePaths, this, this, true); //scriptPath, runningFilePath, null, true, name, outputFilePaths, outputFileProcessor, watcher, true + success = scriptRunner.executeInShell(); + if (success) + success = scriptRunner.monitorAndCleanUpShell(progressIndicator); + } else { + String arguments = argumentsForLogging.toString(); + + arguments=StringUtil.stripBoundingWhitespace(arguments); + externalRunner = new ExternalProcessManager(this, rootDir, getProgramPath(), arguments,getName(), outputFilePaths, this, this, true); + //ShellScriptUtil.changeDirectory(rootDir, rootDir); + externalRunner.setStdOutFileName(outFileName); + success = externalRunner.executeInShell(); + if (success) + success = externalRunner.monitorAndCleanUpShell(progressIndicator); + } if (progressIndicator.isAborted()){ logln("Alignment aborted by user\n"); @@ -387,7 +403,7 @@ else if (!(firstTaxon==0 && lastTaxon==matrix.getNumTaxa())) { // we are doing CommandRecord oldCR = MesquiteThread.getCurrentCommandRecord(); CommandRecord scr = new CommandRecord(true); MesquiteThread.setCurrentCommandRecord(scr); - String failureText = StringUtil.tokenize("Output file containing aligned sequences $$$$$$$$$"); + String failureText = StringUtil.tokenize("Output file containing aligned sequences "); if (data instanceof DNAData) tempDataFile = (MesquiteFile)coord.doCommand("linkFileExp", failureText +" " + StringUtil.tokenize(outFilePath) + " " + StringUtil.tokenize(getDNAImportInterpreter()) + " suppressImportFileSave ", CommandChecker.defaultChecker); //TODO: never scripting??? else diff --git a/Source/mesquite/lib/AlertWithLinkToDirectory.java b/Source/mesquite/lib/AlertWithLinkToDirectory.java index 1bddb68d4..c7d6362a4 100644 --- a/Source/mesquite/lib/AlertWithLinkToDirectory.java +++ b/Source/mesquite/lib/AlertWithLinkToDirectory.java @@ -42,7 +42,8 @@ public AlertWithLinkToDirectory (MesquiteWindow parent, String title, String me addTextArea(message, 5); //nullifyAddPanel(); - addDirectoryButton(); + if (MesquiteFile.canShowDirectory()) + addDirectoryButton(); completeAndShowDialog ("OK", null,true, this); diff --git a/Source/mesquite/lib/ExternalProcessManager.java b/Source/mesquite/lib/ExternalProcessManager.java index dc4ff113d..08162211b 100644 --- a/Source/mesquite/lib/ExternalProcessManager.java +++ b/Source/mesquite/lib/ExternalProcessManager.java @@ -93,6 +93,18 @@ public void setStdErrFileName(String stdErrFileName) { stdErrFilePath = MesquiteFile.getDirectoryPathFromFilePath(directoryPath) + MesquiteFile.fileSeparator + stdErrFileName; } + + public static boolean isAlive(Process proc) { + if (MesquiteTrunk.isJavaGreaterThanOrEqualTo(1.8)) + return proc.isAlive(); + try { + proc.exitValue(); + return false; + } catch (Exception e) { + return true; + } + + } /*.................................................................................................................*/ public Snapshot getSnapshot(MesquiteFile file) { Snapshot temp = new Snapshot(); @@ -233,6 +245,8 @@ public static String[] getStringArrayWithSplitting(String string1, String string /** executes a shell script at "scriptPath". If runningFilePath is not blank and not null, then Mesquite will create a file there that will * serve as a flag to Mesquite that the script is running. */ public boolean executeInShell(){ + if (MesquiteTrunk.isJavaVersionLessThan(1.7)) + return false; proc = null; externalProcess = new MesquiteExternalProcess(); externalProcess.start(directoryPath, stdOutFilePath, stdErrFilePath, getStringArrayWithSplitting(programCommand, programOptions)); @@ -295,7 +309,7 @@ public boolean monitorAndCleanUpShell(ProgressIndicator progressIndicator){ return false; } stillGoing = watcher == null || watcher.continueShellProcess(proc); - if (proc!=null && !proc.isAlive()) { + if (proc!=null && !isAlive(proc)) { stillGoing=false; boolean goodValue = goodExitValue(proc.exitValue(), true); if (!goodValue && !ownerModule.isDoomed() && !watcher.userAborted()) { diff --git a/Source/mesquite/lib/MesquiteDialogParent.java b/Source/mesquite/lib/MesquiteDialogParent.java index 6f7087ad9..86f349a7a 100644 --- a/Source/mesquite/lib/MesquiteDialogParent.java +++ b/Source/mesquite/lib/MesquiteDialogParent.java @@ -176,7 +176,10 @@ public void setVisible(boolean b){ MesquiteDialog.currentWizard = null; if (b && isWizard) MesquiteDialog.currentWizard = this; + if (b) { + pleaseBringToFront(); //This is a workaround to the problem of a more recent dialog box dropping behind an older one. PUts on different thread. super.setVisible(b); + } } public void hideForCalculation(){ diff --git a/Source/mesquite/lib/MesquiteExternalProcess.java b/Source/mesquite/lib/MesquiteExternalProcess.java index 25d283b3f..71cab3a1e 100644 --- a/Source/mesquite/lib/MesquiteExternalProcess.java +++ b/Source/mesquite/lib/MesquiteExternalProcess.java @@ -90,7 +90,7 @@ public void kill () { proc.destroy(); try { Thread.sleep(100); - if (proc.isAlive()) + if (ExternalProcessManager.isAlive(proc)) proc.destroyForcibly(); } catch (Exception e) { } diff --git a/Source/mesquite/lib/MesquiteFile.java b/Source/mesquite/lib/MesquiteFile.java index 935684951..89364fcf6 100644 --- a/Source/mesquite/lib/MesquiteFile.java +++ b/Source/mesquite/lib/MesquiteFile.java @@ -3189,7 +3189,12 @@ public synchronized static void appendFileContents(String relativePath, String c } /*.................................................................................................................*/ - /** Shows the File in the finder or Windows Explorer" */ + /** Returns whether a directory can be shown in the OS's file browser." */ + public static boolean canShowDirectory() { + return (MesquiteTrunk.isMacOSX() || MesquiteTrunk.isWindows()); + } + /*.................................................................................................................*/ + /** Shows the directory specified in path in the Finder or Windows Explorer" */ public static void showDirectory(String path) { if (path == null) return; diff --git a/Source/mesquite/lib/MesquiteModule.java b/Source/mesquite/lib/MesquiteModule.java index 6762413f7..cf72b0641 100644 --- a/Source/mesquite/lib/MesquiteModule.java +++ b/Source/mesquite/lib/MesquiteModule.java @@ -68,12 +68,12 @@ public abstract class MesquiteModule extends EmployerEmployee implements Command /*.................................................................................................................*/ /** returns build date of the Mesquite system (e.g., "22 September 2003") */ public final static String getBuildDate() { - return "12 September 2017"; + return "21 September 2017"; } /*.................................................................................................................*/ /** returns version of the Mesquite system */ public final static String getMesquiteVersion() { - return "3.3"; + return "3.31"; } /*.................................................................................................................*/ /** returns letter in the build number of the Mesquite system (e.g., "e" of "e58") */ @@ -86,7 +86,7 @@ public final static String getBuildLetter() { public final static int getBuildNumber() { //as of 26 Dec 08, build naming changed from letter + number to just number. Accordingly j105 became 473, based on // highest build numbers of d51+e81+g97+h66+i69+j105 + 3 for a, b, c - return 854; + return 858; } //0.95.80 14 Mar 01 - first beta release //0.96 2 April 01 beta - second beta release @@ -133,6 +133,7 @@ public final static int getBuildNumber() { //3.11 = 766 released 3 December 2016, fix of miswriting of codon positions //3.20 = 801 released 1 January 2017 //3.30 = 854 released 12 Sept 2017 + //3.31 = 858 released 20 Sept 2017 /*.................................................................................................................*/ /** returns a string if this is a special version of Mesquite */ public final static String getSpecialVersion() { @@ -1116,6 +1117,17 @@ else if (AlertDialog.query(containerOfModule(), "Problem", s + "\n\nPlease send /*.................................................................................................................*/ /** Displays an alert in connection to an exception*/ public void exceptionAlert(Throwable e, String s) { + String incompatibilityMessage = null; + if (e instanceof NoSuchMethodError){ + incompatibilityMessage = "An error indicates that you may have a package installed that is incompatible " + + "with this version of Mesquite. Please check your add-on packages like Zephyr, Chromaseq, etc. to ensure they are up to date," + + " and that you are using an up to date version of Mesquite."; + } + else if (e instanceof NoClassDefFoundError){ + incompatibilityMessage = "An error indicates that you may have an incomplete version of Mesquite, or a package installed that is incompatible " + + "with this version of Mesquite. Please check your add-on packages like Zephyr, Chromaseq, etc. to ensure they are up to date," + + " and that you are using an up to date version of Mesquite. You may need to reinstall Mesquite."; + } MesquiteTrunk.errorReportedDuringRun = true; StackTraceElement[] stt = e.getStackTrace(); String rep = MesquiteException.lastLocMessage() + "\n"; @@ -1131,6 +1143,8 @@ public void exceptionAlert(Throwable e, String s) { ((MesquiteThread)t).doCleanUp(); logln(s); if (!PhoneHomeUtil.phoneHomeSuccessful || !MesquiteTrunk.reportErrors || MesquiteTrunk.suppressErrorReporting){ + if (incompatibilityMessage != null) + discreetAlert(incompatibilityMessage); if (!MesquiteThread.isScripting() && !AlertDialog.query(containerOfModule(), "Crash", s, "OK", "Force Quit")) MesquiteTrunk.mesquiteTrunk.exit(true, 0); return; @@ -1154,6 +1168,8 @@ else if (MainThread.emergencyCancelled || MesquiteTrunk.errorReportedToHome){// } else { + if (incompatibilityMessage != null) + discreetAlert(incompatibilityMessage); int resp = AlertDialog.query(containerOfModule(), "Crash", s + "\n\nPlease send a report of this crash to the Mesquite server, to help us debug it and improve Mesquite. None of your data will be sent, but your log file up to this point will be sent." + addendum, "OK, Send Report and Continue", "OK, Send and Force Quit", "Close without sending"); if (resp < 2) reportCrashToHome(e, s); diff --git a/Source/mesquite/lib/MesquiteModuleInfo.java b/Source/mesquite/lib/MesquiteModuleInfo.java index 67e20fe2f..c6f55d181 100644 --- a/Source/mesquite/lib/MesquiteModuleInfo.java +++ b/Source/mesquite/lib/MesquiteModuleInfo.java @@ -132,6 +132,9 @@ public MesquiteModuleInfo (Class c, MesquiteModule mb, CommandChecker checker, S this.packageURL = (( PackageIntroInterface)mb).getPackageURL(); isPackageIntro = true; hideable = (( PackageIntroInterface)mb).getHideable(); + if ((( PackageIntroInterface)mb).getMinimumMesquiteVersionRequiredInt()> MesquiteTrunk.mesquiteTrunk.getVersionInt()) + MesquiteTrunk.mesquiteTrunk.discreetAlert("The package " + packageName + + " requires a newer version of Mesquite (at least version " + (( PackageIntroInterface)mb).getMinimumMesquiteVersionRequired() + "). The package might not function properly and may cause crashes."); } mb.mesquiteStartup(); this.nexusBlockTest = mb.getNexusBlockTest();//� diff --git a/Source/mesquite/lib/MesquiteThread.java b/Source/mesquite/lib/MesquiteThread.java index 74f77f732..5e8b59345 100644 --- a/Source/mesquite/lib/MesquiteThread.java +++ b/Source/mesquite/lib/MesquiteThread.java @@ -561,6 +561,15 @@ public String getCurrentCommandExplanation(){ return null; } + /*.................................................................................................................*/ + public static void pauseForMilliseconds(double milliseconds){ + try { + Thread.sleep((int)(milliseconds)); + } + catch (InterruptedException e) { + return; + } + } /*.................................................................................................................*/ public static void pauseForSeconds(double seconds){ try { diff --git a/Source/mesquite/lib/PhoneHomeUtil.java b/Source/mesquite/lib/PhoneHomeUtil.java index 054ef55dc..7978a7881 100644 --- a/Source/mesquite/lib/PhoneHomeUtil.java +++ b/Source/mesquite/lib/PhoneHomeUtil.java @@ -230,11 +230,11 @@ public static void processSingleNotice(MesquiteModuleInfo mmi, StringBuffer noti appliesToBuild = appliesToBuild && (forBuildNumberEqualOrLess >= MesquiteModule.getBuildNumber()); if (MesquiteInteger.isCombinable(forPackageVersionExactly)) - appliesToBuild = appliesToBuild && (forPackageVersionExactly == mmi.getVersionInt()); + appliesToBuild = appliesToBuild && (forPackageVersionExactly == mmi.getPackageVersionInt()); if (MesquiteInteger.isCombinable(forPackageVersionEqualOrGreater)) - appliesToBuild = appliesToBuild && (forPackageVersionEqualOrGreater <= mmi.getVersionInt()); + appliesToBuild = appliesToBuild && (forPackageVersionEqualOrGreater <= mmi.getPackageVersionInt()); if (MesquiteInteger.isCombinable(forPackageVersionEqualOrLess)) - appliesToBuild = appliesToBuild && (forPackageVersionEqualOrLess >= mmi.getVersionInt()); + appliesToBuild = appliesToBuild && (forPackageVersionEqualOrLess >= mmi.getPackageVersionInt()); } @@ -499,7 +499,8 @@ private static String handleMessages(boolean adHoc, String noticesFromHome, Mesq int lastNotice = phoneHomeRecord.getLastNotice(); int lastVersionNoticed = phoneHomeRecord.getLastVersionNoticed(); - + String name = mmi.getName(); + Element root = XMLUtil.getRootXMLElementFromString("mesquite",noticesFromHome); if (root==null) return null; diff --git a/Source/mesquite/lib/ProjectRead.java b/Source/mesquite/lib/ProjectRead.java index d0ae32c34..2f21bdb84 100644 --- a/Source/mesquite/lib/ProjectRead.java +++ b/Source/mesquite/lib/ProjectRead.java @@ -261,7 +261,7 @@ else if (category == 3) MesquiteTrunk.mesquiteTrunk.discreetAlert("OutofMemoryError. See file startingMesquiteAndMemoryAllocation.txt in the Mesquite_Folder for information on how to increase memory allocated to Mesquite."); else if (!(e instanceof ThreadDeath)){ MesquiteFile.throwableToLog(this, e); - MesquiteDialog.closeWizard(); + MesquiteDialog.closeWizard(); MesquiteTrunk.mesquiteTrunk.exceptionAlert(e, "File reading could not be completed because an exception or error occurred (i.e. a crash; " + e.getClass() + "). If you save any files, you might best use Save As... in case data were lost or file saving doesn't work properly."); } MesquiteModule.decrementMenuResetSuppression(); diff --git a/Source/mesquite/lib/ShellScriptRunner.java b/Source/mesquite/lib/ShellScriptRunner.java index 69dd94ce4..a97e9190c 100644 --- a/Source/mesquite/lib/ShellScriptRunner.java +++ b/Source/mesquite/lib/ShellScriptRunner.java @@ -47,7 +47,6 @@ public class ShellScriptRunner implements Commandable { long stdOutLastModified = 0; long stdErrLastModified = 0; boolean aborted = false; - boolean startOutputReaders = true; public ShellScriptRunner(String scriptPath, String runningFilePath, String runningFileMessage, boolean appendRemoveCommand, String name, String[] outputFilePaths, OutputFileProcessor outputFileProcessor, ShellScriptWatcher watcher, boolean visibleTerminal){ @@ -78,11 +77,8 @@ public void setOutErrFilePaths(){ stdOutFilePath = MesquiteFile.getDirectoryPathFromFilePath(runningFilePath) + MesquiteFile.fileSeparator + stOutFileName; stdErrFilePath = MesquiteFile.getDirectoryPathFromFilePath(runningFilePath) + MesquiteFile.fileSeparator + stErrorFileName; } - public boolean getStartOutputReaders() { - return startOutputReaders; - } - public void setStartOutputReaders(boolean startOutputReaders) { - this.startOutputReaders = startOutputReaders; + public static boolean localScriptRunsCanDisplayTerminalWindow(){ + return !MesquiteTrunk.isLinux(); } /*.................................................................................................................*/ @@ -139,11 +135,15 @@ public void setVisibleTerminal(boolean visibleTerminal) { } /*.................................................................................................................*/ public String getStdErr() { - return externalProcessManager.getStdErrContents(); + if (externalProcessManager!=null) + return externalProcessManager.getStdErrContents(); + return ""; } /*.................................................................................................................*/ public String getStdOut() { - return externalProcessManager.getStdOutContents(); + if (externalProcessManager!=null) + return externalProcessManager.getStdOutContents(); + return ""; } /*.................................................................................................................*/ @@ -204,13 +204,11 @@ public boolean executeInShell(){ MesquiteFile.putFileContents(runningFilePath, runningFileMessage, true); if (appendRemoveCommand && MesquiteFile.fileExists(runningFilePath)) MesquiteFile.appendFileContents(scriptPath, StringUtil.lineEnding() + ShellScriptUtil.getRemoveCommand(runningFilePath), true); //append remove command to guarantee that the runningFile is deleted - //+StringUtil.lineEnding()+ShellScriptUtil.getExitCommand() } proc = ShellScriptUtil.executeScript(scriptPath, visibleTerminal); externalProcessManager = new MesquiteExternalProcess(proc); File outputFile = new File(stdOutFilePath); // note this and stErrorFilePath are always within the scriptPath directory File errorFile = new File(stdErrFilePath); -// if (getStartOutputReaders()) externalProcessManager.startFileTailers(outputFile, errorFile); } diff --git a/Source/mesquite/lib/ShellScriptUtil.java b/Source/mesquite/lib/ShellScriptUtil.java index 714728f31..33d641eee 100644 --- a/Source/mesquite/lib/ShellScriptUtil.java +++ b/Source/mesquite/lib/ShellScriptUtil.java @@ -82,13 +82,26 @@ public static String getRemoveCommand(String filePath){ else return "rm -f " + StringUtil.protectFilePathForUnix(filePath) +StringUtil.lineEnding(); } - /*.................................................................................................................*/ + + /** This returns whether or not an exit command for shell scripts is available + * in the OS. This is used to close terminal windows by user choice. However, because visible terminals are + * only used in Windows and Mac, and because the Mac's Terminal can't easily be closed, + * this only returns true for Windows. + */ + public static boolean exitCommandIsAvailableAndUseful(){ + if (MesquiteTrunk.isWindows()) + return true; + return false; + } + + /** This returns the exit command that might be used to quit a visible terminal window from within itself. + */ public static String getExitCommand(){ - if (MesquiteTrunk.isWindows()){ - return ""; + if (MesquiteTrunk.isMacOSX()){ + return "osascript -e 'quit app \"Terminal\"'"; // doesn't fully work as will prompt user } else - return "exit " +StringUtil.lineEnding(); + return "exit "; } /*.................................................................................................................*/ public static String getSetFileTypeCommand(String filePath){ diff --git a/Source/mesquite/lib/TaxaBitsSet.java b/Source/mesquite/lib/TaxaBitsSet.java index b60611519..393481c6e 100644 --- a/Source/mesquite/lib/TaxaBitsSet.java +++ b/Source/mesquite/lib/TaxaBitsSet.java @@ -55,17 +55,25 @@ public boolean swapParts(int first, int second){ return super.swapParts(first, second); } /*.................................................................................................................*/ - public String getStringList(String delimiter, boolean simplify){ + public String getStringList(String delimiter, TaxonNamer namer, boolean justFirst){ StringBuffer sb= new StringBuffer(); boolean first = true; for (int i=0; i0) vertical += panel.requestSpacer(); + if (panel instanceof NotesPanel){ + requestedlHeight = max-vertical - 15; + } if (vertical < max && vertical+requestedlHeight - 18 + 19 1 - 3.3 - 854 - 330 + 3.31 + 858 + 331 http://mesquiteproject.wikispaces.com/Installation + + 330 + 20 + alert + here]]> + 320 - 19 + 20 alert - here]]> 311 - 19 + 20 alert - here]]> 310 - 19 + 20 alert - here]]> 304 - 19 + 20 alert - here]]> 303 - 19 + 20 alert - here]]> 302 - 19 + 20 alert - here]]> 301 - 19 + 20 alert - here]]> 300 - 19 + 20 alert - OLD version of Mesquite. The current version is 3.3. We strongly urge that you update to a new version by downloading it from + OLD version of Mesquite. The current version is 3.31. We strongly urge that you update to a new version by downloading it from here]]> 273 - 19 + 20 alert - VERY OLD version of Mesquite. The current version is 3.3. We strongly urge that you update to a new version by downloading it from + VERY OLD version of Mesquite. The current version is 3.31. We strongly urge that you update to a new version by downloading it from here]]> 274 - 19 + 20 alert - VERY OLD version of Mesquite. The current version is 3.3. We strongly urge that you update to a new version by downloading it from + VERY OLD version of Mesquite. The current version is 3.31. We strongly urge that you update to a new version by downloading it from here]]> 275 - 19 + 20 alert - VERY VERY OLD version of Mesquite. The current version is 3.3. We strongly urge that you update to a new version by downloading it from + VERY VERY OLD version of Mesquite. The current version is 3.31. We strongly urge that you update to a new version by downloading it from here]]> 201 - 19 + 20 alert This notice is to inform you that Mesquite now checks its web site for notices to users (such as this one) when it starts up. This should not cause a delay (if it does, please inform us). We anticipate notices will be given rarely, when there is an update available or an important bug to tell you about.