JAL-3253 jalview.bin.Instance streamlining
[jalview.git] / src / jalview / bin / Jalview.java
index 8af6363..4167753 100755 (executable)
@@ -88,9 +88,15 @@ import groovy.util.GroovyScriptEngine;
 public class Jalview
 {
 
+  public static Jalview getInstance()
+  {
+    Instance i = Instance.getInstance();
+    return (i.jalview == null ? i.jalview = new Jalview() : i.jalview);
+  }
+
   public Jalview()
   {
-    Instance.setJalview(this);
+    Instance.getInstance().jalview = this;
   }
 
   static
@@ -102,7 +108,7 @@ public class Jalview
 
   public static boolean isHeadlessMode()
   {
-    return Instance.getJalview().headless;
+    return getInstance().headless;
   }
 
   private Desktop desktop;
@@ -111,12 +117,12 @@ public class Jalview
 
   public static AlignFrame getCurrentAlignFrame()
   {
-    return Instance.getJalview().currentAlignFrame;
+    return getInstance().currentAlignFrame;
   }
 
   public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
   {
-    Instance.getJalview().currentAlignFrame = currentAlignFrame;
+    getInstance().currentAlignFrame = currentAlignFrame;
   }
 
   static
@@ -312,7 +318,7 @@ public class Jalview
       {
         try
         {
-          Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
+          Jws2Discoverer.getInstance().setPreferredUrl(jabawsUrl);
           System.out.println(
                   "CMD [-jabaws " + jabawsUrl + "] executed successfully!");
         } catch (MalformedURLException e)
@@ -1123,7 +1129,4 @@ public class Jalview
     }
   }
 
-  // BH 2019.05.10 moved here from StructureSelectionManager because this is a
-  // singleton; allows it to be cleaned up when the application is closed.
-
 }