From dfd8d228991732db0871b4b2a9ea19838d9b45b9 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 6 Aug 2010 11:04:56 +0000 Subject: [PATCH] interactive/batch mode test for groovy scripting (See JAL-611) --- src/jalview/bin/Jalview.java | 10 +++++++--- src/jalview/gui/Desktop.java | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index fc6d23e..b599f0f 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -179,6 +179,7 @@ public class Jalview if (!headless) { desktop = new Desktop(); + desktop.setInBatchMode(true); // indicate we are starting up desktop.setVisible(true); desktop.startServiceDiscovery(); if (!aparser.contains("nousagestats")) @@ -536,7 +537,7 @@ public class Jalview startFeatureFetching(getFeatures); } } - // execute a groovy script. + // Once all other stuff is done, execute any groovy scripts (in order) if (groovyscript != null) { if (jalview.bin.Cache.groovyJarsPresent()) @@ -551,8 +552,11 @@ public class Jalview + groovyscript); } } - - // Once all other stuff is done, execute any groovy scripts (in order) + // and finally, turn off batch mode indicator - if the desktop still exists + if (desktop!=null) + { + desktop.setInBatchMode(false); + } } private static void startUsageStats(final Desktop desktop) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 0bf029c..b35495f 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -2088,6 +2088,29 @@ public class Desktop extends jalview.jbgui.GDesktop implements return v_client; } + /** + * flag set if jalview GUI is being operated programmatically + */ + private boolean inBatchMode=false; + + /** + * check if jalview GUI is being operated programmatically + * @return inBatchMode + */ + public boolean isInBatchMode() + { + return inBatchMode; + } + + /** + * set flag if jalview GUI is being operated programmatically + * @param inBatchMode + */ + public void setInBatchMode(boolean inBatchMode) + { + this.inBatchMode = inBatchMode; + } + public void startServiceDiscovery() { -- 1.7.10.2