X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fstructure%2FStructureSelectionManager.java;h=870a8003e8aa8962c2b821bd59809bed6ac3d280;hb=b65330720abd1329eac5fddbed9516b8302abe52;hp=d1bccd8643f5219bfb7378e7652fb6639db0a082;hpb=362f2db1b01f3562784864a1d6ac5f7b9be0a18a;p=jalview.git diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index d1bccd8..870a800 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -152,16 +152,32 @@ public class StructureSelectionManager ex.printStackTrace(); return null; } - + String targetChain; for (int s = 0; s < sequence.length; s++) { + boolean infChain = true; if (targetChains != null && targetChains[s] != null) + { + infChain = false; targetChain = targetChains[s]; + } else if (sequence[s].getName().indexOf("|") > -1) { targetChain = sequence[s].getName().substring( sequence[s].getName().lastIndexOf("|") + 1); + if (targetChain.length() > 1) + { + if (targetChain.trim().length() == 0) + { + targetChain = " "; + } + else + { + // not a valid chain identifier + targetChain = ""; + } + } } else targetChain = ""; @@ -173,14 +189,11 @@ public class StructureSelectionManager boolean first = true; for (int i = 0; i < pdb.chains.size(); i++) { - // TODO: re http://issues.jalview.org/browse/JAL-583 : this patch may - // need to be revoked PDBChain chain = ((PDBChain) pdb.chains.elementAt(i)); - if (targetChain.length() > 0 && !targetChain.equals(chain.id)) + if (targetChain.length() > 0 && !targetChain.equals(chain.id) && !infChain) { continue; // don't try to map chains don't match. } - // end of patch for limiting computed mappings // TODO: correctly determine sequence type for mixed na/peptide // structures AlignSeq as = new AlignSeq(sequence[s], @@ -336,6 +349,11 @@ public class StructureSelectionManager public void mouseOverStructure(int pdbResNum, String chain, String pdbfile) { + if (listeners==null) + { + // old or prematurely sent event + return; + } boolean hasSequenceListeners = handlingVamsasMo || seqmappings != null; SearchResults results = null; SequenceI lastseq = null; @@ -491,6 +509,9 @@ public class StructureSelectionManager ((VamsasListener) listeners.elementAt(i)).mouseOver(seq, indexpos, source); } + else if(listeners.elementAt(i) instanceof SecondaryStructureListener){ + ((SecondaryStructureListener) listeners.elementAt(i)).mouseOverSequence(seq,indexpos); + } } } } @@ -771,13 +792,24 @@ public class StructureSelectionManager */ public static void release(StructureSelectionManagerProvider jalviewLite) { - StructureSelectionManager mnger=(instances.get(jalviewLite)); - if (mnger!=null) +// synchronized (instances) { - instances.remove(jalviewLite); - try { - mnger.finalize(); - } catch (Throwable x){}; + if (instances == null) + { + return; + } + StructureSelectionManager mnger = (instances.get(jalviewLite)); + if (mnger != null) + { + instances.remove(jalviewLite); + try + { + mnger.finalize(); + } catch (Throwable x) + { + } + ; + } } }