From: Jim Procter Date: Tue, 7 Oct 2014 16:25:37 +0000 (+0100) Subject: patch for JAL-1151 - select whole sequence when double clicking on associated annotat... X-Git-Tag: Jalview_2_9~171^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7d09d300046920b2ffedc7c14f08f9ce55647bd7;p=jalview.git patch for JAL-1151 - select whole sequence when double clicking on associated annotation's id --- diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index ab7a07a..b5ebbbe 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -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()); diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index cce98a1..7aa3ae3 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -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);