JAL-1753 JAL-1596 asynchronous command to Chimera (with progress update)
[jalview.git] / 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();
+
+  }
 }