From d8a109085881c62e2fdf6fd3ece21d9b3dfdb2e2 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 21 Jan 2011 17:03:40 +0000 Subject: [PATCH] ensure source is rarely null --- src/jalview/javascript/JsSelectionSender.java | 30 +++++-------------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/jalview/javascript/JsSelectionSender.java b/src/jalview/javascript/JsSelectionSender.java index d948363..e55c658 100644 --- a/src/jalview/javascript/JsSelectionSender.java +++ b/src/jalview/javascript/JsSelectionSender.java @@ -35,34 +35,16 @@ public class JsSelectionSender extends JSFunctionExec implements String setid = ""; String viewid = ""; AlignFrame src = _af; - // filter events if necessary - if (source instanceof AlignViewport) + if (source != null) { - if (_af != null - && !_af.alignPanel.av.getSequenceSetId().equals( - ((AlignViewport) source).getSequenceSetId())) + if (source instanceof jalview.appletgui.AlignViewport + && ((jalview.appletgui.AlignViewport) source).applet.currentAlignFrame.viewport == source) { - return; - } - jalview.appletgui.AlignmentPanel[] aps = jalview.appletgui.PaintRefresher - .getAssociatedPanels(setid = ((AlignViewport) source) - .getSequenceSetId()); - for (int a = 0; a < aps.length; a++) - { - System.out.println("Selection: testing source alignPanel : " - + aps[a].getName()); - if (aps[a].av == source) - { - src = aps[a].alignFrame; - } + // should be valid if it just generated an event! + src = ((jalview.appletgui.AlignViewport) source).applet.currentAlignFrame; + } } - else - { - // unhandled! - System.err.println("Unhandled selection source !"); - return; - } String[] seqs = new String[] {}; String[] cols = new String[] -- 1.7.10.2