JAL-1486 fix: pass selected region to jalview.io via alignment view and align viewpor...
authorj.procter@dundee.ac.uk <jprocter@carderbee.dyn.lifesci.dundee.ac.uk>
Fri, 12 Sep 2014 16:04:03 +0000 (17:04 +0100)
committerj.procter@dundee.ac.uk <jprocter@carderbee.dyn.lifesci.dundee.ac.uk>
Fri, 12 Sep 2014 16:04:03 +0000 (17:04 +0100)
src/jalview/gui/PopupMenu.java

index 44860a1..25cad0a 100644 (file)
@@ -2071,23 +2071,21 @@ public class PopupMenu extends JPopupMenu
     System.out.println("PROMPT USER HERE"); // TODO: decide if a prompt happens
     // or we simply trust the user wants
     // wysiwig behaviour
-    SequenceGroup sg = ap.av.getSelectionGroup();
-    ColumnSelection csel = new ColumnSelection(ap.av.getColumnSelection());
-    omitHidden = ap.av.getViewAsString(true);
-    Alignment oal = new Alignment(ap.av.getSequenceSelection());
-    AlignmentAnnotation[] nala = ap.av.getAlignment()
-            .getAlignmentAnnotation();
-    if (nala != null)
+
+    AlignmentView selvew = ap.av.getAlignmentView(true, false);
+    AlignmentI aselview = selvew.getVisibleAlignment(ap.av
+            .getGapCharacter());
+    List<AlignmentAnnotation> ala = (ap.av
+            .getVisibleAlignmentAnnotation(true));
+    if (ala != null)
     {
-      for (int i = 0; i < nala.length; i++)
+      for (AlignmentAnnotation aa : ala)
       {
-        AlignmentAnnotation na = nala[i];
-        oal.addAnnotation(na);
+        aselview.addAnnotation(aa);
       }
     }
     cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(),
-            oal, omitHidden, csel, sg));
-    oal = null;
+            aselview, null, null, null));
   }
 
   public void pdbFromFile_actionPerformed()