refactor to allow distinct StructureSelectionManager instances for
[jalview.git] / src / jalview / gui / AlignmentPanel.java
old mode 100755 (executable)
new mode 100644 (file)
index 3ea6496..d2aa6d6
@@ -33,12 +33,13 @@ import jalview.datamodel.*;
 import jalview.jbgui.*;
 import jalview.schemes.*;
 import jalview.structure.SelectionSource;
+import jalview.structure.StructureSelectionManager;
 
 /**
  * DOCUMENT ME!
  * 
  * @author $author$
- * @version $Revision$
+ * @version $Revision: 1.161 $
  */
 public class AlignmentPanel extends GAlignmentPanel implements
         AdjustmentListener, Printable, AlignmentViewPanel
@@ -683,8 +684,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
     if (updateOverview)
     {
-      jalview.structure.StructureSelectionManager
-              .getStructureSelectionManager().sequenceColoursChanged(this);
+      av.getStructureSelectionManager().sequenceColoursChanged(this);
 
       if (overviewPanel != null)
       {
@@ -1320,15 +1320,14 @@ public class AlignmentPanel extends GAlignmentPanel implements
    */
   public void closePanel()
   {
-    jalview.structure.StructureSelectionManager ssm = jalview.structure.StructureSelectionManager
-            .getStructureSelectionManager();
-    ssm.removeStructureViewerListener(seqPanel, null);
-    ssm.removeSelectionListener(seqPanel);
     PaintRefresher.RemoveComponent(seqPanel.seqCanvas);
     PaintRefresher.RemoveComponent(idPanel.idCanvas);
     PaintRefresher.RemoveComponent(this);
     if (av != null)
     {
+      jalview.structure.StructureSelectionManager ssm = av.getStructureSelectionManager();
+      ssm.removeStructureViewerListener(seqPanel, null);
+      ssm.removeSelectionListener(seqPanel);
       av.alignment = null;
       av = null;
     }
@@ -1445,4 +1444,10 @@ public class AlignmentPanel extends GAlignmentPanel implements
       alignFrame.setDisplayedView(this);
     } 
   }
+
+  @Override
+  public StructureSelectionManager getStructureSelectionManager()
+  {
+    return av.getStructureSelectionManager();
+  }
 }