JAL-3518 separation of ChimeraXManager, pull up of closeViewer etc
[jalview.git] / src / jalview / ext / rbvi / chimera / ChimeraCommands.java
index dd7b446..857dbcc 100644 (file)
@@ -40,6 +40,14 @@ import jalview.util.ColorUtils;
  */
 public class ChimeraCommands extends StructureCommandsBase
 {
+  private static final StructureCommand CLOSE_CHIMERA = new StructureCommand("stop really");
+
+  private static final StructureCommand STOP_NOTIFY_SELECTION = new StructureCommand("listen stop selection");
+
+  private static final StructureCommand STOP_NOTIFY_MODELS = new StructureCommand("listen stop models");
+
+  private static final StructureCommand GET_SELECTION = new StructureCommand("list selection level residue");
+
   private static final StructureCommand SHOW_BACKBONE = new StructureCommand(
           "~display all;~ribbon;chain @CA|P");
 
@@ -410,7 +418,33 @@ public class ChimeraCommands extends StructureCommandsBase
   public StructureCommandI closeViewer()
   {
     // https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/stop.html
-    return new StructureCommand("stop really");
+    return CLOSE_CHIMERA;
+  }
+
+  @Override
+  public List<StructureCommandI> startNotifications(String uri)
+  {
+    // https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/listen.html
+    List<StructureCommandI> cmds = new ArrayList<>();
+    cmds.add(new StructureCommand("listen start models url " + uri));
+    cmds.add(new StructureCommand("listen start select prefix SelectionChanged url " + uri));
+    return cmds;
+  }
+
+  @Override
+  public List<StructureCommandI> stopNotifications()
+  {
+    // https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/listen.html
+    List<StructureCommandI> cmds = new ArrayList<>();
+    cmds.add(STOP_NOTIFY_MODELS);
+    cmds.add(STOP_NOTIFY_SELECTION);
+    return cmds;
+  }
+
+  @Override
+  public StructureCommandI getSelectedResidues()
+  {
+    return GET_SELECTION;
   }
 
 }