JAL-4279 suppress error dialogs raised by file loader when working in batch mode
[jalview.git] / src / jalview / bin / Jalview.java
index e229079..eabad91 100755 (executable)
@@ -139,9 +139,9 @@ public class Jalview
 
   public static AlignFrame currentAlignFrame;
 
-  public ArgParser argparser = null;
+  private ArgParser argparser = null;
 
-  public BootstrapArgs bootstrapArgs = null;
+  private BootstrapArgs bootstrapArgs = null;
 
   private boolean QUIET = false;
 
@@ -811,6 +811,7 @@ public class Jalview
     }
     // Run Commands from cli
     cmds = new Commands(argparser, headlessArg);
+    cmds.processArgs();
     boolean commandsSuccess = cmds.argsWereParsed();
 
     if (commandsSuccess)
@@ -1501,7 +1502,7 @@ public class Jalview
       UIManager.put("TabbedPane.tabType", "card");
       UIManager.put("TabbedPane.showTabSeparators", true);
       UIManager.put("TabbedPane.showContentSeparator", true);
-      UIManager.put("TabbedPane.tabSeparatorsFullHeight", true);
+      // UIManager.put("TabbedPane.tabSeparatorsFullHeight", true);
       UIManager.put("TabbedPane.tabsOverlapBorder", true);
       UIManager.put("TabbedPane.hasFullBorder", true);
       UIManager.put("TabbedPane.tabLayoutPolicy", "scroll");
@@ -1781,7 +1782,7 @@ public class Jalview
     Jalview.currentAlignFrame = currentAlignFrame;
   }
 
-  protected Commands getCommands()
+  public Commands getCommands()
   {
     return cmds;
   }
@@ -1828,10 +1829,23 @@ public class Jalview
    * 
    * TEST OUTPUT METHODS
    * 
+   * these operate only when Arg.TESTOUTPUT has been passed, and variously check
+   * if an expected value / arg was set and report it to the test framework.
+   * 
    ******************************/
   /**
-   * method for reporting string values parsed/processed during tests
+   * report string values parsed/processed during tests When the Bootstrap
+   * argument Arg.TESTOUTPUT is present - reports on debug if given s1 is not
+   * null and not equals s2, warns if given argument is not set, and calls
+   * testoutput(true,a,s1,s2) to report processing progress.
    * 
+   * @param ap
+   *          - ArgParser handling parsing
+   * @param a
+   *          - Arg currently being processed
+   * @param s1
+   *          - expected 
+   * @param s2
    */
   protected static void testoutput(ArgParser ap, Arg a, String s1,
           String s2)
@@ -1856,7 +1870,9 @@ public class Jalview
   }
 
   /**
-   * method for reporting string values parsed/processed during tests
+   * report values passed via bootstrap arguments
+   * 
+   * TODO: significant code duplication with testouput(Argparser...) - move it
    */
 
   protected static void testoutput(BootstrapArgs bsa, Arg a, String s1,
@@ -1884,7 +1900,7 @@ public class Jalview
   }
 
   /**
-   * report value set for string values parsed/processed during 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)
   {
@@ -1951,4 +1967,20 @@ public class Jalview
     }
     Console.outPrintln("[TESTOUTPUT] arg " + message);
   }
+
+  public ArgParser getArgParser()
+  {
+    return argparser;
+  }
+
+  public BootstrapArgs getBootstrapArgs()
+  {
+    return bootstrapArgs;
+  }
+
+  public static boolean isBatchMode()
+  {
+    return getInstance()!=null && (getInstance().desktop == null || getInstance().desktop.isInBatchMode());
+  }
+
 }