From 7d09d300046920b2ffedc7c14f08f9ce55647bd7 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 7 Oct 2014 17:25:37 +0100 Subject: [PATCH] patch for JAL-1151 - select whole sequence when double clicking on associated annotation's id --- src/jalview/appletgui/AnnotationLabels.java | 14 ++++++++++++-- src/jalview/gui/AnnotationLabels.java | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) 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); -- 1.7.10.2