JAL-4307 View->Ligands submenu, implementation for Jmol and documentation
[jalview.git] / src / jalview / ext / jmol / JmolCommands.java
index 01dac9b..106d458 100644 (file)
@@ -316,7 +316,38 @@ public class JmolCommands extends StructureCommandsBase
     return new StructureCommand(
             "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
@@ -500,16 +531,4 @@ public class JmolCommands extends StructureCommandsBase
   {
     return null; // not an external viewer
   }
-
-  @Override
-  public StructureCommandI saveState(String label)
-  {
-    return new StructureCommand("save STATE " + label);
-  }
-
-  @Override
-  public StructureCommandI restoreState(String label)
-  {
-    return new StructureCommand("restore STATE " + label);
-  }
 }