JAL-1528 new Preference CHIMERA_PATH (Preferences | Structure)
[jalview.git] / src / ext / edu / ucsf / rbvi / strucviz2 / StructureManager.java
index ec956d7..1208638 100644 (file)
@@ -1,12 +1,14 @@
 package ext.edu.ucsf.rbvi.strucviz2;
 
+import jalview.bin.Cache;
+import jalview.gui.Preferences;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -32,10 +34,6 @@ public class StructureManager
   static final String[] defaultResidueKeys =
   { "FunctionalResidues", "ResidueList", "Residues" };
 
-  private final String chimeraPropertyName = "chimera";
-
-  private final String chimeraPathPropertyKey = "LastChimeraPath";
-
   public enum ModelType
   {
     PDB_MODEL, MODBASE_MODEL, SMILES
@@ -494,7 +492,9 @@ public class StructureManager
       // we do not care about the model anymore
       selSpec = selSpec.concat(nodeInfo.toSpec());
       if (i < chimSelectionList.size() - 1)
+      {
         selSpec.concat("|");
+      }
     }
     if (selSpec.length() > 0)
     {
@@ -665,7 +665,9 @@ public class StructureManager
     for (ChimeraStructuralObject cso : chimSelectionList)
     {
       if (cso != null)
+      {
         cso.setSelected(false);
+      }
     }
     chimSelectionList.clear();
   }
@@ -879,17 +881,16 @@ public class StructureManager
       }
     }
 
-    // if no network settings, check if the last chimera path is saved in the
-    // session
-    // String lastPath = CytoUtils.getDefaultChimeraPath(registrar,
-    // chimeraPropertyName,
-    // chimeraPathPropertyKey);
-    // if (lastPath != null && !lastPath.equals("")) {
-    // pathList.add(lastPath);
-    // return pathList;
-    // }
+    /*
+     * Jalview addition: check if path set in user preferences.
+     */
+    String userPath = Cache.getDefault(Preferences.CHIMERA_PATH, null);
+    if (userPath != null)
+    {
+      pathList.add(userPath);
+    }
 
-    // if no user settings and no last path, get default system's settings
+    // Add default installation paths
     String os = System.getProperty("os.name");
     if (os.startsWith("Linux"))
     {