From 4a48933bbf342fd495288cd9bde44b9eee3f9706 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 28 Jun 2013 07:30:16 +0100 Subject: [PATCH] JAL-1337 plugin flag to prevent Jalview from quitting the VM --- src/jalview/bin/Cache.java | 10 +++++++++- src/jalview/gui/Desktop.java | 9 +++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) 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) -- 1.7.10.2