JAL-2295 (optionally) return Chimera command reply
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 11 Nov 2016 08:50:57 +0000 (08:50 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 11 Nov 2016 08:50:57 +0000 (08:50 +0000)
src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java

index 8601b1b..3d6e239 100644 (file)
@@ -596,31 +596,40 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
   }
 
   /**
-   * Send a command to Chimera, and optionally log any responses.
+   * Send a command to Chimera, and optionally log and return any responses
    * 
    * @param command
-   * @param logResponse
+   * @param getResponse
    */
-  public void sendChimeraCommand(final String command, boolean logResponse)
+  public List<String> sendChimeraCommand(final String command,
+          boolean getResponse)
   {
     if (viewer == null)
     {
       // ? thread running after viewer shut down
-      return;
+      return null;
     }
+    List<String> reply = null;
     viewerCommandHistory(false);
     if (lastCommand == null || !lastCommand.equals(command))
     {
       // trim command or it may never find a match in the replyLog!!
       List<String> lastReply = viewer.sendChimeraCommand(command.trim(),
-              logResponse);
-      if (logResponse && debug)
+              getResponse);
+      if (getResponse)
       {
-        log("Response from command ('" + command + "') was:\n" + lastReply);
+        reply = lastReply;
+        if (debug)
+        {
+          log("Response from command ('" + command + "') was:\n"
+                  + lastReply);
+        }
       }
     }
     viewerCommandHistory(true);
     lastCommand = command;
+
+    return reply;
   }
 
   /**