JAL-3253 preliminary static fixes for JavaScript part 3 of 3
[jalview.git] / src / jalview / ws / sifts / SiftsSettings.java
index 5e2c526..31274d9 100644 (file)
  */
 package jalview.ws.sifts;
 
+import jalview.bin.Jalview;
+
 import java.util.Objects;
 
 public class SiftsSettings
 {
-  private static boolean mapWithSifts = false;
+  private boolean mapWithSifts = false;
+
+  private String siftDownloadDirectory;
 
-  private static String siftDownloadDirectory;
+  private int cacheThresholdInDays;
 
-  private static int cacheThresholdInDays;
+  private int failSafePIDThreshold;
 
-  private static int failSafePIDThreshold;
+  private static SiftsSettings getInstance()
+  {
+    {
+      Jalview j = Jalview.getInstance();
+      return (j.siftsSettings == null
+              ? j.siftsSettings = new SiftsSettings()
+              : j.siftsSettings);
+    }
 
+  }
   public static boolean isMapWithSifts()
   {
-    return mapWithSifts;
+    return getInstance().mapWithSifts;
   }
 
   public static void setMapWithSifts(boolean mapWithSifts)
   {
-    SiftsSettings.mapWithSifts = mapWithSifts;
+    getInstance().mapWithSifts = mapWithSifts;
   }
 
   public static String getSiftDownloadDirectory()
   {
-    return siftDownloadDirectory;
+    return getInstance().siftDownloadDirectory;
   }
 
   public static void setSiftDownloadDirectory(String siftDownloadDirectory)
   {
-    SiftsSettings.siftDownloadDirectory = siftDownloadDirectory;
+    getInstance().siftDownloadDirectory = siftDownloadDirectory;
   }
 
   public static int getCacheThresholdInDays()
   {
-    return cacheThresholdInDays;
+    return getInstance().cacheThresholdInDays;
   }
 
   public static void setCacheThresholdInDays(String cacheThresholdInDays)
   {
     Objects.requireNonNull(cacheThresholdInDays);
-    SiftsSettings.cacheThresholdInDays = Integer
+    getInstance().cacheThresholdInDays = Integer
             .valueOf(cacheThresholdInDays);
   }
 
   public static int getFailSafePIDThreshold()
   {
-    return failSafePIDThreshold;
+    return getInstance().failSafePIDThreshold;
   }
 
   public static void setFailSafePIDThreshold(String failSafePIDThreshold)
   {
     Objects.requireNonNull(failSafePIDThreshold);
-    SiftsSettings.failSafePIDThreshold = Integer
+    getInstance().failSafePIDThreshold = Integer
             .valueOf(failSafePIDThreshold);
   }
 }