JAL-1479 Refactored Sifts configuration preference in order to rectify applet build
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 17 Nov 2015 11:10:13 +0000 (11:10 +0000)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 17 Nov 2015 11:10:13 +0000 (11:10 +0000)
src/jalview/gui/Preferences.java
src/jalview/structure/StructureSelectionManager.java
src/jalview/ws/sifts/SiftsSettings.java [new file with mode: 0644]

index 885a62f..33068a8 100755 (executable)
@@ -30,6 +30,7 @@ import jalview.jbgui.GPreferences;
 import jalview.jbgui.GSequenceLink;
 import jalview.schemes.ColourSchemeProperty;
 import jalview.util.MessageManager;
+import jalview.ws.sifts.SiftsSettings;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -316,10 +317,12 @@ public class Preferences extends GPreferences
     if (Cache.getDefault("MAP_WITH_SIFTS", false))
     {
       siftsMapping.setSelected(true);
+      SiftsSettings.setMapWithSifts(true);
     }
     else
     {
       nwMapping.setSelected(true);
+      SiftsSettings.setMapWithSifts(false);
     }
 
     /*
@@ -504,6 +507,7 @@ public class Preferences extends GPreferences
     Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
     Cache.applicationProperties.setProperty("MAP_WITH_SIFTS",
             Boolean.toString(siftsMapping.isSelected()));
+    SiftsSettings.setMapWithSifts(siftsMapping.isSelected());
 
     /*
      * Save Output settings
index e9053ed..678bf3b 100644 (file)
@@ -37,6 +37,7 @@ import jalview.util.MappingUtils;
 import jalview.util.MessageManager;
 import jalview.ws.sifts.SiftsClient;
 import jalview.ws.sifts.SiftsException;
+import jalview.ws.sifts.SiftsSettings;
 
 import java.io.PrintStream;
 import java.util.ArrayList;
@@ -373,8 +374,7 @@ public class StructureSelectionManager
       }
     }
     PDBfile pdb = null;
-    boolean isMapUsingSIFTs = Boolean.valueOf(jalview.bin.Cache.getDefault(
-            "MAP_WITH_SIFTS", "false"));
+    boolean isMapUsingSIFTs = SiftsSettings.isMapWithSifts();
     SiftsClient siftsClient = null;
     try
     {
diff --git a/src/jalview/ws/sifts/SiftsSettings.java b/src/jalview/ws/sifts/SiftsSettings.java
new file mode 100644 (file)
index 0000000..c666e2c
--- /dev/null
@@ -0,0 +1,16 @@
+package jalview.ws.sifts;
+
+public class SiftsSettings
+{
+  private static boolean mapWithSifts = false;
+
+  public static boolean isMapWithSifts()
+  {
+    return mapWithSifts;
+  }
+
+  public static void setMapWithSifts(boolean mapWithSifts)
+  {
+    SiftsSettings.mapWithSifts = mapWithSifts;
+  }
+}