JAL-3390 pull-up refactoring towards functional changes...
[jalview.git] / src / jalview / gui / JalviewChimeraBindingModel.java
index 801b285..2da93ce 100644 (file)
@@ -28,13 +28,12 @@ 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;
 
-  private FeatureRenderer fr = null;
-
-
   public JalviewChimeraBindingModel(ChimeraViewFrame chimeraViewFrame,
           StructureSelectionManager ssm, PDBEntry[] pdbentry,
           SequenceI[][] sequenceIs, DataSourceType protocol)
@@ -50,17 +49,10 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
             : (AlignmentPanel) alignment;
     if (ap.av.isShowSequenceFeatures())
     {
-      if (fr == null)
-      {
-        fr = (jalview.gui.FeatureRenderer) ap.cloneFeatureRenderer();
-      }
-      else
-      {
-        ap.updateFeatureRenderer(fr);
-      }
+      return ap.getSeqPanel().seqCanvas.fr;
     }
 
-    return fr;
+    return null;
   }
 
   @Override
@@ -85,21 +77,6 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
   }
 
   @Override
-  public void updateColours(Object source)
-  {
-    AlignmentPanel ap = (AlignmentPanel) source;
-    // ignore events from panels not used to colour this view
-    if (!cvf.isUsedforcolourby(ap))
-    {
-      return;
-    }
-    if (!isLoadingFromArchive())
-    {
-      colourBySequence(ap.av.isShowSequenceFeatures(), ap);
-    }
-  }
-
-  @Override
   public void releaseReferences(Object svl)
   {
   }
@@ -122,24 +99,25 @@ 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 stm = cvf.startProgressBar(progressMsg);
         try
         {
           sendChimeraCommand(command, false);
         } finally
         {
-          cvf.stopProgressBar(null, stm);
+          if (progressMsg != null)
+          {
+            cvf.stopProgressBar(null, handle);
+          }
         }
       }
     });
-    thread.start();
-
   }
 
   @Override