JAL-1753 JAL-1596 JAL-1933 ensure AWT updates are on AWT thread
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 5 Dec 2016 10:08:29 +0000 (10:08 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 5 Dec 2016 10:08:29 +0000 (10:08 +0000)
src/jalview/gui/JalviewChimeraBindingModel.java

index 8d11ca0..bd890d9 100644 (file)
@@ -28,6 +28,8 @@ import jalview.ext.rbvi.chimera.JalviewChimeraBinding;
 import jalview.io.DataSourceType;
 import jalview.structure.StructureSelectionManager;
 
+import javax.swing.SwingUtilities;
+
 public class JalviewChimeraBindingModel extends JalviewChimeraBinding
 {
   private ChimeraViewFrame cvf;
@@ -122,17 +124,13 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
   protected void sendAsynchronousCommand(final String command,
           final String progressMsg)
   {
-    Thread thread = new Thread(new Runnable()
+    final long handle = progressMsg == null ? 0 : cvf
+            .startProgressBar(progressMsg);
+    SwingUtilities.invokeLater(new Runnable()
     {
-
       @Override
       public void run()
       {
-        long handle = 0;
-        if (progressMsg != null)
-        {
-          handle = cvf.startProgressBar(progressMsg);
-        }
         try
         {
           sendChimeraCommand(command, false);
@@ -145,8 +143,6 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
         }
       }
     });
-    thread.start();
-
   }
 
   @Override