JAL-1528 new Preference CHIMERA_PATH (Preferences | Structure)
[jalview.git] / src / jalview / bin / Cache.java
index a48b750..24ed1b4 100755 (executable)
@@ -173,6 +173,7 @@ import org.apache.log4j.SimpleLayout;
  * display</li>
  * <li>STRUCTURE_DISPLAY choose from JMOL (default) or CHIMERA for 3D structure
  * display</li>
+ * <li>CHIMERA_PATH specify full path to Chimera program (if non-standard)</li>
  * 
  * </ul>
  * Deprecated settings:
@@ -906,4 +907,27 @@ public class Cache
     }
     return sourceRegistry;
   }
+
+  /**
+   * Set the specified value, or remove it if null or empty. Does not save the
+   * properties file.
+   * 
+   * @param propName
+   * @param value
+   */
+  public static void setOrRemove(String propName, String value)
+  {
+    if (propName == null)
+    {
+      return;
+    }
+    if (value == null || value.trim().length() < 1)
+    {
+      Cache.applicationProperties.remove(propName);
+    }
+    else
+    {
+      Cache.applicationProperties.setProperty(propName, value);
+    }
+  }
 }