patch for JAL-1151 - select whole sequence when double clicking on associated annotat...
authorJim Procter <j.procter@dundee.ac.uk>
Tue, 7 Oct 2014 16:25:37 +0000 (17:25 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Tue, 7 Oct 2014 16:25:37 +0000 (17:25 +0100)
src/jalview/appletgui/AnnotationLabels.java
src/jalview/gui/AnnotationLabels.java

index ab7a07a..b5ebbbe 100755 (executable)
@@ -657,8 +657,18 @@ public class AnnotationLabels extends Panel implements ActionListener,
           else if (evt.getClickCount() >= 2)
           {
             ap.seqPanel.ap.idPanel.highlightSearchResults(null);
-            SequenceGroup sg = new SequenceGroup();
-            sg.addSequence(aa[selectedRow].sequenceRef, false);
+            SequenceGroup sg = ap.av.getSelectionGroup();
+            if (sg!=null)
+            {
+                sg = new SequenceGroup(sg);
+                sg.clear();
+                sg.addSequence(aa[selectedRow].sequenceRef, false);
+            } else {
+              sg = new SequenceGroup();
+              sg.setStartRes(0);
+              sg.setEndRes(ap.av.getAlignment().getWidth()-1);
+              sg.addSequence(aa[selectedRow].sequenceRef, false);
+            }
             ap.av.setSelectionGroup(sg);
             ap.paintAlignment(false);
             PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
index cce98a1..7aa3ae3 100755 (executable)
@@ -518,8 +518,18 @@ public class AnnotationLabels extends JPanel implements MouseListener,
           else if (evt.getClickCount() >= 2)
           {
             ap.seqPanel.ap.idPanel.highlightSearchResults(null);
-            SequenceGroup sg = new SequenceGroup();
-            sg.addSequence(aa[selectedRow].sequenceRef, false);
+            SequenceGroup sg = ap.av.getSelectionGroup();
+            if (sg!=null)
+            {
+                sg = new SequenceGroup(sg);
+                sg.clear();
+                sg.addSequence(aa[selectedRow].sequenceRef, false);
+            } else {
+              sg = new SequenceGroup();
+              sg.setStartRes(0);
+              sg.setEndRes(ap.av.getAlignment().getWidth()-1);
+              sg.addSequence(aa[selectedRow].sequenceRef, false);
+            }
             ap.av.setSelectionGroup(sg);
             ap.av.sendSelection();
             ap.paintAlignment(false);