JAL-4290 Set structureSelectionManager settings more generically and when no desktop...
[jalview.git] / src / jalview / structure / StructureSelectionManager.java
index ec3e0a0..5865b7f 100644 (file)
@@ -34,6 +34,7 @@ import java.util.Vector;
 
 import jalview.analysis.AlignSeq;
 import jalview.api.StructureSelectionManagerProvider;
+import jalview.bin.Cache;
 import jalview.bin.Console;
 import jalview.commands.CommandI;
 import jalview.commands.EditCommand;
@@ -50,6 +51,7 @@ import jalview.datamodel.SearchResultsI;
 import jalview.datamodel.SequenceI;
 import jalview.ext.jmol.JmolParser;
 import jalview.gui.IProgressIndicator;
+import jalview.gui.Preferences;
 import jalview.io.AppletFormatAdapter;
 import jalview.io.DataSourceType;
 import jalview.io.StructureFile;
@@ -1665,4 +1667,25 @@ public class StructureSelectionManager
     return pdbIdFileName;
   }
 
+  public static void doConfigureStructurePrefs(
+          StructureSelectionManager ssm)
+  {
+    if (Cache.getDefault(Preferences.ADD_SS_ANN, true))
+    {
+      ssm.setAddTempFacAnnot(
+              Cache.getDefault(Preferences.ADD_TEMPFACT_ANN, true));
+      ssm.setProcessSecondaryStructure(
+              Cache.getDefault(Preferences.STRUCT_FROM_PDB, true));
+      // JAL-3915 - RNAView is no longer an option so this has no effect
+      ssm.setSecStructServices(
+              Cache.getDefault(Preferences.USE_RNAVIEW, false));
+    }
+    else
+    {
+      ssm.setAddTempFacAnnot(false);
+      ssm.setProcessSecondaryStructure(false);
+      ssm.setSecStructServices(false);
+    }
+  }
+
 }