JAL-892 check viewer is linked to alignment panel on save to XML
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 19 Jun 2015 16:11:17 +0000 (17:11 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 19 Jun 2015 16:11:17 +0000 (17:11 +0100)
src/jalview/gui/Jalview2XML.java

index 8dfe839..0ebc804 100644 (file)
@@ -868,7 +868,7 @@ public class Jalview2XML
         }
       }
 
-      saveRnaViewers(jout, jseq, jds, viewIds, storeDS);
+      saveRnaViewers(jout, jseq, jds, viewIds, ap, storeDS);
 
       jms.addJSeq(jseq);
     }
@@ -1365,10 +1365,12 @@ public class Jalview2XML
    * @param jseq
    * @param jds
    * @param viewIds
+   * @param ap
    * @param storeDataset
    */
   protected void saveRnaViewers(JarOutputStream jout, JSeq jseq,
-          final SequenceI jds, List<String> viewIds, boolean storeDataset)
+          final SequenceI jds, List<String> viewIds, AlignmentPanel ap,
+          boolean storeDataset)
   {
     JInternalFrame[] frames = Desktop.desktop.getAllFrames();
     for (int f = frames.length - 1; f > -1; f--)
@@ -1376,11 +1378,12 @@ public class Jalview2XML
       if (frames[f] instanceof AppVarna)
       {
         AppVarna varna = (AppVarna) frames[f];
-        if (varna.isListeningFor(jds))
+        /*
+         * link the sequence to every viewer that is showing it and is linked to
+         * its alignment panel
+         */
+        if (varna.isListeningFor(jds) && ap == varna.getAlignmentPanel())
         {
-          /*
-           * link the sequence to every viewer that is showing it
-           */
           String viewId = varna.getViewId();
           RnaViewer rna = new RnaViewer();
           rna.setViewId(viewId);