From: Jim Procter Date: Fri, 28 Jun 2013 06:30:16 +0000 (+0100) Subject: JAL-1337 plugin flag to prevent Jalview from quitting the VM X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4a48933bbf342fd495288cd9bde44b9eee3f9706;p=jalview.git JAL-1337 plugin flag to prevent Jalview from quitting the VM --- diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 5d26b85..43619f8 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -200,7 +200,15 @@ public class Cache static String propertiesFile; private static boolean propsAreReadOnly = false; - + private static boolean plugin=false; + public static void setPlugin(boolean plugin) + { + Cache.plugin=plugin; + } + public static boolean isPlugin() + { + return plugin; + } public static void initLogger() { if (log != null) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 877aebb..0a56da2 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -283,7 +283,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements doGroovyCheck(); setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION")); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setDefaultCloseOperation(!jalview.bin.Cache.isPlugin() ? JFrame.EXIT_ON_CLOSE : JFrame.DISPOSE_ON_CLOSE); boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE", false); boolean showjconsole = jalview.bin.Cache.getDefault( @@ -1054,7 +1054,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements dialogExecutor.shutdownNow(); } - System.exit(0); + if (!jalview.bin.Cache.isPlugin()) { + System.exit(0); + } else { + setVisible(false); + dispose(); + } } private void storeLastKnownDimensions(String string, Rectangle jc)