X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=5d82015cacd1e6b8b79fa93259eb4ecedb74e542;hb=92d66803db3319c4db605177d502de91302ef684;hp=ff8d52ff32103d4de206a81118357d463332cb1b;hpb=984b20fa94376c549b75bda56bf4ec2fecb4cdd6;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index ff8d52f..5d82015 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -86,6 +86,7 @@ import java.util.Map; import java.util.Vector; import javax.swing.LookAndFeel; +import javax.swing.SwingUtilities; import javax.swing.UIManager; import groovy.lang.Binding; @@ -148,6 +149,8 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi private boolean noAnnotation; + public static final String TERMINATOR_LINE = "Jalview argument parsing complete."; + public boolean getStartCalculations() { return !noCalculation; @@ -312,6 +315,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi || "true".equals(System.getProperty("java.awt.headless"))) { headless = true; + setSynchronous(true); } if (isJS) @@ -346,7 +350,6 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi System.exit(0); } - // anything else! final String jabawsUrl = aparser.getValue(ArgsParser.JABAWS); @@ -402,11 +405,11 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi try { if (!isJS && Platform.isWin()) - { + { UIManager.setLookAndFeel( headless ? "javax.swing.plaf.metal.MetalLookAndFeel" : UIManager.getSystemLookAndFeelClassName()); -// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } } catch (Exception ex) { @@ -460,7 +463,21 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi SequenceOntologyFactory.setSequenceOntology(new SequenceOntology()); } - if (!headless) + if (headless) + { + // If this is not tested, then + + if (aparser.contains(ArgsParser.NOUSAGESTATS)) + { + System.err.println("CMD [-nousagestats] executed successfully!"); + } + if (aparser.contains(ArgsParser.NOQUESTIONNAIRE)) + { + System.err.println("CMD [-noquestionnaire] executed successfully!"); + } + + } + else { desktop = Desktop.getInstance(); desktop.setInBatchMode(true); // indicate we are starting up @@ -527,6 +544,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } parseArguments(aparser, true); + System.err.println(TERMINATOR_LINE); } /** @@ -2170,5 +2188,82 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi // + " " + status); } -} + /** + * flag to allow selected Runnable and Thread processes to run synchronously + * + * JAL-3563 + * + */ + private static boolean isSynchronous = false; + + /** + * Set Jalview to run selected processes synchronously in test and headless + * environments. + * + * JAL-3563 + * + * @param b + * @author Bob Hanson + */ + public static void setSynchronous(boolean b) + { + isSynchronous = b; + } + + /** + * Allows optional synchronous running of a Runnable that would otherwise use + * SwingUtilities.invokeLater. + * + * JAL-3563 + * + * @param t + * @author Bob Hanson + */ + public static boolean isSynchronous() + { + return isSynchronous; + } + + /** + * Allows optional synchronous running of a Runnable that would otherwise use + * SwingUtilities.invokeLater. + * + * JAL-3563 + * + * @param t + * @author Bob Hanson + */ + public static void execRunnable(Runnable r) + { + if (isSynchronous()) + { + r.run(); + } + else + { + SwingUtilities.invokeLater(r); + } + } + + /** + * Allows optional synchronous running of a thread that would otherwise be run + * using start(). + * + * JAL-3563 + * + * @param t + * @author Bob Hanson + */ + public static void execThread(Thread t) + { + if (isSynchronous()) + { + t.run(); + } + else + { + t.start(); + } + } +} \ No newline at end of file