JAL-1753 JAL-1596 asynchronous command to Chimera (with progress update)
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 5 Jun 2015 13:49:22 +0000 (14:49 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 5 Jun 2015 13:49:22 +0000 (14:49 +0100)
src/jalview/gui/JalviewChimeraBindingModel.java

index 0dcde11..a5af244 100644 (file)
@@ -89,4 +89,31 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
   public void refreshPdbEntries()
   {
   }
+
+  /**
+   * Send an asynchronous command to Chimera, in a new thread, optionally with
+   * an 'in progress' message in a progress bar somewhere
+   */
+  protected void sendAsynchronousCommand(final String command,
+          final String progressMsg)
+  {
+    Thread thread = new Thread(new Runnable()
+    {
+
+      @Override
+      public void run()
+      {
+    long stm = cvf.startProgressBar(progressMsg);
+    try
+    {
+      sendChimeraCommand(command, false);
+    } finally
+    {
+      cvf.stopProgressBar(null, stm);
+    }
+      }
+    });
+  thread.start();
+
+  }
 }