From 6fb2cd8a74354ef16d9bb2a6e596f30ab5aa7d1d Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Sun, 12 Feb 2012 17:04:00 +0000 Subject: [PATCH] (JAL-1022) ensure all Jmol model filenames are normalised with File().getAbsolutePath() before binding to associated sequences in the structure manager. --- src/jalview/ext/jmol/JalviewJmolBinding.java | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 38e58d8..4a1efe6 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -690,10 +690,17 @@ public abstract class JalviewJmolBinding implements StructureListener, String mset[] = new String[viewer.getModelCount()]; _modelFileNameMap = new int[mset.length]; int j = 1; - mset[0] = viewer.getModelFileName(0); + String m=viewer.getModelFileName(0); + if (m!=null) + { + mset[0] = new File(m).getAbsolutePath(); + } for (int i = 1; i < mset.length; i++) { - mset[j] = viewer.getModelFileName(i); + m=viewer.getModelFileName(i); + if (m!=null) { + mset[j] = new File(m).getAbsolutePath(); + } _modelFileNameMap[j] = i; // record the model index for the filename // skip any additional models in the same file (NMR structures) if ((mset[j] == null ? mset[j] != mset[j - 1] @@ -869,8 +876,16 @@ public abstract class JalviewJmolBinding implements StructureListener, try { // recover PDB filename for the model hovered over. - pdbfilename = viewer - .getModelFileName(new Integer(mdlId).intValue() - 1); + int _mp=_modelFileNameMap.length-1, + mnumber=new Integer(mdlId).intValue() - 1; + while(mnumber<_modelFileNameMap[_mp]) + { + _mp--; + } + pdbfilename = modelFileNames[_mp]; + if (pdbfilename==null) {pdbfilename=new File(viewer + .getModelFileName(mnumber)).getAbsolutePath(); + } } catch (Exception e) { -- 1.7.10.2