From: Ben Soares Date: Fri, 8 Sep 2023 13:43:09 +0000 (+0100) Subject: JAL-4262 Dialog for GUI and WARN for CLI of old style arguments, or mixed arguments... X-Git-Tag: Release_2_11_3_0~8^2~5^2~30^2~2 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=985d5f40db480896f550db914297cf948a32e963 JAL-4262 Dialog for GUI and WARN for CLI of old style arguments, or mixed arguments \(with exit\). Changed Jalview.exit to use an enum for exit code to avoid collisions. --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 0c4f165..eafabb2 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1464,3 +1464,6 @@ action.cluster_matrix = Cluster matrix action.clustering_matrix_for = Calculating tree for matrix {0} and clustering at {1} action.cluster_matrix_tooltip = Computes an average distance tree for the matrix and displays it label.all_known_alignment_files = All known alignment files +label.command_line_arguments = Command Line Arguments +warning.using_old_command_line_arguments = It looks like you are using old command line arguments. These are now deprecated and will be removed in a future release of Jalview.\nFind out about the new command line arguments at\n +warning.using_mixed_command_line_arguments = Jalview cannot use both old (-arg) and new (--arg) command line arguments. Please check your command line arguments.\ne.g. {0} and {1} diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index 1f256cb..72b49f8 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -1438,3 +1438,6 @@ label.nothing_selected = Nada seleccionado prompt.analytics_title = Jalview Estadísticas de Uso prompt.analytics = ¿Quiere ayudar a mejorar Jalview habilitando la recopilación de estadísticas de uso con análisis Plausible?\nPuede habilitar o deshabilitar el seguimiento de uso en las preferencias. label.all_known_alignment_files = Todos los archivos de alineación conocidos +label.command_line_arguments = Argumentos de línea de comando +warning.using_old_command_line_arguments = Parece que estás utilizando argumentos antiguos de línea de comando. Estos ahora están en desuso y se eliminarán en una versión futura de Jalview.\nObtenga más información sobre los nuevos argumentos de la línea de comando en\n +warning.using_mixed_command_line_arguments = Jalview no puede utilizar argumentos de línea de comando antiguos (-arg) y nuevos (--arg). Verifique los argumentos de su línea de comando.\ne.g. {0} y {1} diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index 8164182..d910819 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -14,6 +14,7 @@ import java.util.Map; import jalview.analysis.AlignmentUtils; import jalview.api.structures.JalviewStructureDisplayI; +import jalview.bin.Jalview.ExitCode; import jalview.bin.argparser.Arg; import jalview.bin.argparser.ArgParser; import jalview.bin.argparser.ArgParser.Position; @@ -140,7 +141,9 @@ public class Commands } if (argParser.getBoolean(Arg.QUIT)) { - Jalview.getInstance().quit(); + Jalview.getInstance().exit( + "Exiting due to " + Arg.QUIT.argString() + " argument.", + ExitCode.OK); return true; } // carry on with jalview.bin.Jalview @@ -249,21 +252,24 @@ public class Commands Console.debug( "Opening '" + openFile + "' in new alignment frame"); FileLoader fileLoader = new FileLoader(!headless); - boolean xception=false; - try { + boolean xception = false; + try + { af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol, format); } catch (Throwable thr) { - xception=true; - Console.error("Couldn't open '"+openFile+"' as "+format+" "+thr.getLocalizedMessage()+ " (Enable debug for full stack trace)"); - Console.debug("Exception when opening '"+openFile+"'",thr); - } - finally + xception = true; + Console.error("Couldn't open '" + openFile + "' as " + format + + " " + thr.getLocalizedMessage() + + " (Enable debug for full stack trace)"); + Console.debug("Exception when opening '" + openFile + "'", thr); + } finally { - if (af==null && !xception) + if (af == null && !xception) { - Console.info("Ignoring '"+openFile+"' - no alignment data found."); + Console.info("Ignoring '" + openFile + + "' - no alignment data found."); continue; } } @@ -410,7 +416,8 @@ public class Commands { if (headless) { - Jalview.exit("Could not open any files in headless mode", 1); + Jalview.exit("Could not open any files in headless mode", + ExitCode.NO_FILES); } else { @@ -946,7 +953,7 @@ public class Commands Jalview.exit("No valid format specified for " + Arg.OUTPUT.argString() + ". Valid formats are " - + validSB.toString() + ".", 1); + + validSB.toString() + ".", ExitCode.INVALID_FORMAT); // this return really shouldn't happen return false; } diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index eabad91..51e8a82 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -426,7 +426,7 @@ public class Jalview // stop now if only after --version if (bootstrapArgs.contains(Arg.VERSION)) { - Jalview.exit(null, 0); + Jalview.exit(null, ExitCode.OK); } // old ArgsParser @@ -458,7 +458,7 @@ public class Jalview error.printStackTrace(); String message = "\nEssential logging libraries not found." + "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview"; - Jalview.exit(message, 0); + Jalview.exit(message, ExitCode.OK); } // register SIGTERM listener @@ -545,7 +545,7 @@ public class Jalview .getList(Arg.HELP); Console.outPrintln(Arg.usage(helpArgs.stream().map(e -> e.getKey()) .collect(Collectors.toList()))); - Jalview.exit(null, 0); + Jalview.exit(null, ExitCode.OK); } if (aparser.contains("help") || aparser.contains("h")) { @@ -554,7 +554,7 @@ public class Jalview showUsage(); */ Console.outPrintln(Arg.usage()); - Jalview.exit(null, 0); + Jalview.exit(null, ExitCode.OK); } // new CLI @@ -648,7 +648,7 @@ public class Jalview error.printStackTrace(); String message = "\nEssential logging libraries not found." + "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview"; - Jalview.exit(message, 0); + Jalview.exit(message, ExitCode.OK); } desktop = null; @@ -809,6 +809,30 @@ public class Jalview } } } + else + { + + if (getArgParser().isMixedStyle()) + { + String warning = MessageManager.formatMessage( + "warning.using_mixed_command_line_arguments", + getArgParser().getMixedExamples()); + Console.warn(warning); + Jalview.exit( + "Exiting due to mixed old and new command line arguments", + ExitCode.INVALID_ARGUMENT); + } + if (getArgParser().isOldStyle()) + { + String warning = MessageManager + .getString("warning.using_old_command_line_arguments") + .replace("\n", " ") + + "https://www.jalview.org/help/html/features/commandline.html"; + Console.warn(warning); + } + + } + // Run Commands from cli cmds = new Commands(argparser, headlessArg); cmds.processArgs(); @@ -827,7 +851,7 @@ public class Jalview else { Jalview.exit("Successfully completed commands in headless mode", - 0); + ExitCode.OK); } } Console.info("Successfully completed commands"); @@ -836,7 +860,8 @@ public class Jalview { if (headlessArg) { - Jalview.exit("Error when running Commands in headless mode", 1); + Jalview.exit("Error when running Commands in headless mode", + ExitCode.ERROR_RUNNING_COMMANDS); } Console.warn("Error when running commands"); } @@ -867,7 +892,7 @@ public class Jalview if (file == null && desktop == null && !commandsSuccess) { - Jalview.exit("No files to open!", 1); + Jalview.exit("No files to open!", ExitCode.NO_FILES); } long progress = -1; @@ -897,7 +922,8 @@ public class Jalview if (headless) { Jalview.exit( - "Can't find file '" + file + "' in headless mode", 1); + "Can't find file '" + file + "' in headless mode", + ExitCode.FILE_NOT_FOUND); } Console.warn("Can't find file'" + file + "'"); } @@ -1769,7 +1795,7 @@ public class Jalview public void quit() { // System.exit will run the shutdownHook first - Jalview.exit("Quitting now. Bye!", 0); + Jalview.exit("Quitting now. Bye!", ExitCode.OK); } public static AlignFrame getCurrentAlignFrame() @@ -1787,8 +1813,9 @@ public class Jalview return cmds; } - public static void exit(String message, int exitcode) + public static void exit(String message, ExitCode ec) { + int exitcode = ec == ExitCode.OK ? 0 : ec.ordinal() + 1; if (Console.log == null) { // Don't start the logger just to exit! @@ -1825,6 +1852,14 @@ public class Jalview } } + public enum ExitCode + { + // only add new ones to the end of the list (to preserve ordinal values) + OK, FILE_NOT_FOUND, FILE_NOT_READABLE, NO_FILES, INVALID_FORMAT, + INVALID_ARGUMENT, INVALID_VALUE, MIXED_CLI_ARGUMENTS, + ERROR_RUNNING_COMMANDS; + } + /****************************** * * TEST OUTPUT METHODS @@ -1844,7 +1879,7 @@ public class Jalview * @param a * - Arg currently being processed * @param s1 - * - expected + * - expected * @param s2 */ protected static void testoutput(ArgParser ap, Arg a, String s1, @@ -1900,7 +1935,8 @@ public class Jalview } /** - * conditionally (on @param yes) report that expected value s1 was set during CommandsTest tests + * conditionally (on @param yes) report that expected value s1 was set during + * CommandsTest tests */ private static void testoutput(boolean yes, Arg a, String s1, String s2) { @@ -1980,7 +2016,8 @@ public class Jalview public static boolean isBatchMode() { - return getInstance()!=null && (getInstance().desktop == null || getInstance().desktop.isInBatchMode()); + return getInstance() != null && (getInstance().desktop == null + || getInstance().desktop.isInBatchMode()); } } diff --git a/src/jalview/bin/argparser/ArgParser.java b/src/jalview/bin/argparser/ArgParser.java index 3862375..6e53770 100644 --- a/src/jalview/bin/argparser/ArgParser.java +++ b/src/jalview/bin/argparser/ArgParser.java @@ -37,6 +37,7 @@ import java.util.Map; import jalview.bin.Cache; import jalview.bin.Console; import jalview.bin.Jalview; +import jalview.bin.Jalview.ExitCode; import jalview.bin.argparser.Arg.Opt; import jalview.bin.argparser.Arg.Type; import jalview.util.FileUtils; @@ -177,6 +178,15 @@ public class ArgParser private BootstrapArgs bootstrapArgs = null; + private boolean oldArguments = false; + + private boolean mixedArguments = false; + + /** + * saved examples of mixed arguments + */ + private String[] mixedExamples = new String[] { null, null }; + static { argMap = new HashMap<>(); @@ -241,19 +251,39 @@ public class ArgParser if (arg.startsWith(DOUBLEDASH)) { dd = true; - break; + if (mixedExamples[1] == null) + { + mixedExamples[1] = arg; + } } else if (arg.startsWith("-") || arg.equals("open")) { d = true; + if (mixedExamples[0] == null) + { + mixedExamples[0] = arg; + } + } + } + if (d) + { + if (dd) + { + mixedArguments = true; + } + else + { + oldArguments = true; } } - if (d && !dd) + + if (oldArguments || mixedArguments) { // leave it to the old style -- parse an empty list parse(new ArrayList(), false, false); return; } + if (bsa != null) this.bootstrapArgs = bsa; else @@ -379,10 +409,12 @@ public class ArgParser { // arg not found Console.error("Argument '" + arg + "' not recognised. Exiting."); - Jalview.exit("Invalid argument used." + System.lineSeparator() - + "Use" + System.lineSeparator() + "jalview " - + Arg.HELP.argString() + System.lineSeparator() - + "for a usage statement.", 13); + Jalview.exit( + "Invalid argument used." + System.lineSeparator() + "Use" + + System.lineSeparator() + "jalview " + + Arg.HELP.argString() + System.lineSeparator() + + "for a usage statement.", + ExitCode.INVALID_ARGUMENT); continue; } if (a.hasOption(Opt.PRIVATE) && !allowPrivate) @@ -915,7 +947,7 @@ public class ArgParser { String message = Arg.ARGFILE.argString() + EQUALS + "\"" + argFile.getPath() + "\": File does not exist."; - Jalview.exit(message, 2); + Jalview.exit(message, ExitCode.FILE_NOT_FOUND); } try { @@ -929,7 +961,7 @@ public class ArgParser { String message = Arg.ARGFILE.argString() + "=\"" + argFile.getPath() + "\": File could not be read."; - Jalview.exit(message, 3); + Jalview.exit(message, ExitCode.FILE_NOT_READABLE); } } // Third param "true" uses Opt.PRIVATE args --setargile=argfile and @@ -955,7 +987,7 @@ public class ArgParser String message = Arg.ARGFILE.argString() + "=\"" + argFile.getPath() + "\": File could not be read."; Console.debug(message, e); - Jalview.exit(message, 3); + Jalview.exit(message, ExitCode.FILE_NOT_READABLE); } } return args; @@ -1341,4 +1373,18 @@ public class ArgParser return linkedArgs.get(linkedId); } + public boolean isOldStyle() + { + return oldArguments; + } + + public boolean isMixedStyle() + { + return mixedArguments; + } + + public String[] getMixedExamples() + { + return mixedExamples; + } } \ No newline at end of file diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 035da25..6b2044c 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -87,9 +87,11 @@ import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JMenuItem; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JProgressBar; +import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; @@ -106,6 +108,7 @@ import jalview.api.AlignmentViewPanel; import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.bin.Jalview; +import jalview.bin.Jalview.ExitCode; import jalview.datamodel.Alignment; import jalview.datamodel.HiddenColumns; import jalview.datamodel.Sequence; @@ -635,6 +638,62 @@ public class Desktop extends jalview.jbgui.GDesktop // used for jalviewjsTest jalview.bin.Console.info("JALVIEWJS: CREATED DESKTOP"); } + + cliWarning(); + } + + /** + * Warning about old or mixed command line arguments + */ + private void cliWarning() + { + Jalview j = Jalview.getInstance(); + boolean oldStyle = j.getArgParser() != null + && j.getArgParser().isOldStyle(); + boolean mixedStyle = j.getArgParser() != null + && j.getArgParser().isMixedStyle(); + + String title = MessageManager.getString("label.command_line_arguments"); + if (mixedStyle) + { + String warning = MessageManager.formatMessage( + "warning.using_mixed_command_line_arguments", + j.getArgParser().getMixedExamples()); + String quit = MessageManager.getString("action.quit"); + JvOptionPane jvp = JvOptionPane.newOptionDialog(this); + jvp.setResponseHandler(JOptionPane.YES_OPTION, () -> { + }); + jvp.showDialogOnTopAsync(this, warning, title, JOptionPane.YES_OPTION, + JOptionPane.WARNING_MESSAGE, null, new Object[] + { quit }, quit, true, null, false); + + Jalview.getInstance().exit( + "Exiting due to mixed old and new command line arguments.", + ExitCode.MIXED_CLI_ARGUMENTS); + return; + } + if (oldStyle) + { + String warning = MessageManager + .getString("warning.using_old_command_line_arguments") + + "https://www.jalview.org/help/html/features/commandline.html"; + + JTextArea jta = new JTextArea(2, 32); + // jta.setLineWrap(true); + jta.setEditable(false); + jta.setWrapStyleWord(true); + jta.setAutoscrolls(true); + jta.setText(warning); + + String ok = MessageManager.getString("label.continue"); + JvOptionPane jvp = JvOptionPane.newOptionDialog(this); + jvp.setResponseHandler(JOptionPane.YES_OPTION, () -> { + }); + jvp.showDialogOnTopAsync(this, jta, title, JOptionPane.YES_OPTION, + JOptionPane.WARNING_MESSAGE, null, new Object[] + { ok }, ok, false, null, false); + } + } /** @@ -1081,23 +1140,23 @@ public class Desktop extends jalview.jbgui.GDesktop setKeyBindings(frame); - // Since the latest FlatLaf patch, we occasionally have problems showing structureViewer frames... - int tries=3; - boolean shown=false; - Exception last=null; + // Since the latest FlatLaf patch, we occasionally have problems showing + // structureViewer frames... + int tries = 3; + boolean shown = false; + Exception last = null; do { try { desktop.add(frame); - shown=true; + shown = true; } catch (IllegalArgumentException iaex) { - last=iaex; + last = iaex; tries--; - jalview.bin.Console.info( - "Squashed IllegalArgument Exception (" + tries + " left) for "+frame.getTitle(), - iaex); + jalview.bin.Console.info("Squashed IllegalArgument Exception (" + + tries + " left) for " + frame.getTitle(), iaex); try { Thread.sleep(5); @@ -1109,7 +1168,9 @@ public class Desktop extends jalview.jbgui.GDesktop } while (!shown && tries > 0); if (!shown) { - jalview.bin.Console.error("Serious Problem whilst showing window "+frame.getTitle(),last); + jalview.bin.Console.error( + "Serious Problem whilst showing window " + frame.getTitle(), + last); } windowMenu.add(menuItem); @@ -1522,7 +1583,7 @@ public class Desktop extends jalview.jbgui.GDesktop // this will run the shutdownHook but QuitHandler.getQuitResponse() should // not run a second time if gotQuitResponse flag has been set (i.e. user // confirmed quit of some kind). - Jalview.exit("Desktop exiting.", 0); + Jalview.exit("Desktop exiting.", ExitCode.OK); } private void storeLastKnownDimensions(String string, Rectangle jc) @@ -1635,7 +1696,8 @@ public class Desktop extends jalview.jbgui.GDesktop } } catch (Exception ex) { - jalview.bin.Console.errPrintln("Error opening help: " + ex.getMessage()); + jalview.bin.Console + .errPrintln("Error opening help: " + ex.getMessage()); } } @@ -1866,7 +1928,8 @@ public class Desktop extends jalview.jbgui.GDesktop boolean autoSave = projectFile != null && !saveAs && BackupFiles.getEnabled(); - // jalview.bin.Console.outPrintln("autoSave="+autoSave+", projectFile='"+projectFile+"', + // jalview.bin.Console.outPrintln("autoSave="+autoSave+", + // projectFile='"+projectFile+"', // saveAs="+saveAs+", Backups // "+(BackupFiles.getEnabled()?"enabled":"disabled")); @@ -3660,14 +3723,16 @@ public class Desktop extends jalview.jbgui.GDesktop Desktop us = Desktop.instance; Desktop.instance = null; // call dispose in a separate thread - try to avoid indirect deadlocks - new Thread(new Runnable() { + new Thread(new Runnable() + { @Override public void run() { ExecutorService dex = us.dialogExecutor; - if (dex!=null) { + if (dex != null) + { dex.shutdownNow(); - us.dialogExecutor=null; + us.dialogExecutor = null; us.block.drainPermits(); } us.dispose(); diff --git a/src/jalview/gui/JvOptionPane.java b/src/jalview/gui/JvOptionPane.java index 5b926c3..3f5de0a 100644 --- a/src/jalview/gui/JvOptionPane.java +++ b/src/jalview/gui/JvOptionPane.java @@ -722,7 +722,8 @@ public class JvOptionPane extends JOptionPane private static void outputMessage(Object message) { - jalview.bin.Console.outPrintln(">>> JOption Message : " + message.toString()); + jalview.bin.Console + .outPrintln(">>> JOption Message : " + message.toString()); } public static Object getMockResponse() @@ -1264,6 +1265,17 @@ public class JvOptionPane extends JOptionPane int JOPTIONPANE_MESSAGETYPE, Icon icon, Object[] options, Object initialValue, boolean modal, JButton[] buttons) { + showDialogOnTopAsync(dialogParent, label, actionString, + JOPTIONPANE_OPTION, JOPTIONPANE_MESSAGETYPE, icon, options, + initialValue, modal, buttons, true); + } + + public void showDialogOnTopAsync(JFrame dialogParent, Object label, + String actionString, int JOPTIONPANE_OPTION, + int JOPTIONPANE_MESSAGETYPE, Icon icon, Object[] options, + Object initialValue, boolean modal, JButton[] buttons, + boolean dispose) + { if (!isInteractiveMode()) { handleResponse(getMockResponse()); @@ -1285,8 +1297,11 @@ public class JvOptionPane extends JOptionPane JOPTIONPANE_MESSAGETYPE, icon, options, initialValue, modal, buttons); - dialogParent.setAlwaysOnTop(false); - dialogParent.dispose(); + if (dispose) + { + dialogParent.setAlwaysOnTop(false); + dialogParent.dispose(); + } } /** diff --git a/src/jalview/io/NewickFile.java b/src/jalview/io/NewickFile.java index 38ee9ca..a43dc42 100755 --- a/src/jalview/io/NewickFile.java +++ b/src/jalview/io/NewickFile.java @@ -36,6 +36,7 @@ import java.util.StringTokenizer; import com.stevesoft.pat.Regex; import jalview.bin.Jalview; +import jalview.bin.Jalview.ExitCode; import jalview.datamodel.BinaryNode; import jalview.datamodel.SequenceNode; import jalview.util.MessageManager; @@ -324,7 +325,7 @@ public class NewickFile extends FileParse { c.setRight(new SequenceNode(null, c, null, DefDistance, DefBootstrap, false)); - c = (BinaryNode) c.right(); + c = c.right(); } else { @@ -338,7 +339,7 @@ public class NewickFile extends FileParse c.setLeft(new SequenceNode(null, c, null, DefDistance, DefBootstrap, false)); - c = (BinaryNode) c.left(); + c = c.left(); } if (realroot == null) @@ -579,7 +580,7 @@ public class NewickFile extends FileParse // Just advance focus, if we need to if ((c.left() != null) && (!c.left().isLeaf())) { - c = (BinaryNode) c.left(); + c = c.left(); } } } @@ -617,7 +618,7 @@ public class NewickFile extends FileParse } // THe next line is failing for topali trees - not sure why yet. if // (root.right()!=null && root.isDummy()) - root = (SequenceNode) root.right().detach(); // remove the imaginary root. + root = root.right().detach(); // remove the imaginary root. if (!RootHasDistance) { @@ -947,7 +948,8 @@ public class NewickFile extends FileParse if (args == null || args.length != 1) { Jalview.exit( - "Takes one argument - file name of a newick tree file.", 0); + "Takes one argument - file name of a newick tree file.", + ExitCode.INVALID_ARGUMENT); } File fn = new File(args[0]); @@ -969,20 +971,24 @@ public class NewickFile extends FileParse jalview.bin.Console.outPrintln("Original file :\n"); Regex nonl = new Regex("\n+", ""); - jalview.bin.Console.outPrintln(nonl.replaceAll(newickfile.toString()) + "\n"); + jalview.bin.Console + .outPrintln(nonl.replaceAll(newickfile.toString()) + "\n"); jalview.bin.Console.outPrintln("Parsed file.\n"); - jalview.bin.Console.outPrintln("Default output type for original input.\n"); + jalview.bin.Console + .outPrintln("Default output type for original input.\n"); jalview.bin.Console.outPrintln(trf.print()); jalview.bin.Console.outPrintln("Without bootstraps.\n"); jalview.bin.Console.outPrintln(trf.print(false)); jalview.bin.Console.outPrintln("Without distances.\n"); jalview.bin.Console.outPrintln(trf.print(true, false)); - jalview.bin.Console.outPrintln("Without bootstraps but with distanecs.\n"); + jalview.bin.Console + .outPrintln("Without bootstraps but with distanecs.\n"); jalview.bin.Console.outPrintln(trf.print(false, true)); jalview.bin.Console.outPrintln("Without bootstraps or distanecs.\n"); jalview.bin.Console.outPrintln(trf.print(false, false)); - jalview.bin.Console.outPrintln("With bootstraps and with distances.\n"); + jalview.bin.Console + .outPrintln("With bootstraps and with distances.\n"); jalview.bin.Console.outPrintln(trf.print(true, true)); } catch (java.io.IOException e) { diff --git a/src/jalview/util/AWTConsole.java b/src/jalview/util/AWTConsole.java index f6145c2..6fa7c5c 100644 --- a/src/jalview/util/AWTConsole.java +++ b/src/jalview/util/AWTConsole.java @@ -49,6 +49,7 @@ import java.io.PipedOutputStream; import java.io.PrintStream; import jalview.bin.Jalview; +import jalview.bin.Jalview.ExitCode; public class AWTConsole extends WindowAdapter implements WindowListener, ActionListener, Runnable @@ -176,7 +177,7 @@ public class AWTConsole extends WindowAdapter } catch (Exception e) { } - Jalview.exit("Window closing. Bye!", 0); + Jalview.exit("Window closing. Bye!", ExitCode.OK); } @Override