JAL-2295 handle no progress bar message properly
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 7 Nov 2016 11:01:22 +0000 (11:01 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 7 Nov 2016 11:01:22 +0000 (11:01 +0000)
src/jalview/gui/JalviewChimeraBindingModel.java

index 7a54732..ec30e7f 100644 (file)
@@ -72,6 +72,7 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
   {
     javax.swing.SwingUtilities.invokeLater(new Runnable()
     {
+      @Override
       public void run()
       {
         cvf.updateTitleAndMenus();
@@ -80,6 +81,7 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
     });
   }
 
+  @Override
   public void updateColours(Object source)
   {
     AlignmentPanel ap = (AlignmentPanel) source;
@@ -113,6 +115,7 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
    * Send an asynchronous command to Chimera, in a new thread, optionally with
    * an 'in progress' message in a progress bar somewhere
    */
+  @Override
   protected void sendAsynchronousCommand(final String command,
           final String progressMsg)
   {
@@ -122,13 +125,20 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
       @Override
       public void run()
       {
-        long stm = cvf.startProgressBar(progressMsg);
+        long handle = 0;
+        if (progressMsg != null)
+        {
+          handle = cvf.startProgressBar(progressMsg);
+        }
         try
         {
           sendChimeraCommand(command, false);
         } finally
         {
-          cvf.stopProgressBar(null, stm);
+          if (progressMsg != null)
+          {
+            cvf.stopProgressBar(null, handle);
+          }
         }
       }
     });