Merge branch 'releases/Release_2_11_3_Branch'
[jalview.git] / src / jalview / ext / jmol / JmolCommands.java
index 7fa47a1..7c024ba 100644 (file)
@@ -241,7 +241,8 @@ public class JmolCommands extends StructureCommandsBase
     /*
      * https://chemapps.stolaf.edu/jmol/docs/#writemodel
      */
-    StructureCommand sc = new StructureCommand("write STATE \"" + filepath + "\"");
+    StructureCommand sc = new StructureCommand(
+            "write STATE \"" + filepath + "\"");
     sc.setWaitNeeded(true);
     return sc;
   }
@@ -319,6 +320,39 @@ public class JmolCommands extends StructureCommandsBase
             "load FILES \"" + Platform.escapeBackslashes(file) + "\"");
   }
 
+  @Override
+  public StructureCommandI restoreSession(String filePath)
+  {
+    return new StructureCommand("restore STATE \""
+            + Platform.escapeBackslashes(filePath) + "\"");
+  }
+
+  @Override
+  public List<StructureCommandI> showHetatms(List<String> toShow)
+  {
+    // always clear the current hetero cpk display
+
+    StringBuilder sb = new StringBuilder();
+    sb.append("select hetero; cpk off;");
+
+    if (toShow != null && !toShow.isEmpty())
+    {
+      // select what was requested
+      sb.append("select ");
+      boolean or = false;
+      for (String k : toShow)
+      {
+        sb.append(or ? " or " : " ");
+        sb.append(k);
+        or = true;
+      }
+      // and show as
+      sb.append("; cpk;");
+    }
+
+    return Arrays.asList(new StructureCommand(sb.toString()));
+  }
+
   /**
    * Obsolete method, only referenced from
    * jalview.javascript.MouseOverStructureListener