From: Jim Procter Date: Fri, 25 Apr 2014 13:26:04 +0000 (+0100) Subject: JAL-1177 patches to loader to cope with dataset only jalview xml documents X-Git-Tag: Jalview_2_9~195^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=18e6142e442c42442429c12ff48c7d637b855dca;p=jalview.git JAL-1177 patches to loader to cope with dataset only jalview xml documents --- diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 5f9a131..3499f6d 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1836,7 +1836,7 @@ public class Jalview2XML frefedSequence = new Vector(); } - jalview.gui.AlignFrame af = null; + jalview.gui.AlignFrame af= null,_af = null; Hashtable gatherToThisFrame = new Hashtable(); final String file = jprovider.getFilename(); try @@ -1863,10 +1863,15 @@ public class Jalview2XML object = (JalviewModel) unmar.unmarshal(in); if (true) // !skipViewport(object)) { - af = LoadFromObject(object, file, true, jprovider); - if (af.viewport.gatherViewsHere) + _af = LoadFromObject(object, file, true, jprovider); + if (object.getJalviewModelSequence().getViewportCount() > 0) { - gatherToThisFrame.put(af.viewport.getSequenceSetId(), af); + af = _af; + if (object.getJalviewModelSequence().getViewportCount() > 1 + && af.viewport.gatherViewsHere) + { + gatherToThisFrame.put(af.viewport.getSequenceSetId(), af); + } } } entryCount++; @@ -2089,7 +2094,8 @@ public class Jalview2XML JalviewModelSequence jms = object.getJalviewModelSequence(); - Viewport view = jms.getViewport(0); + Viewport view = (jms.getViewportCount()>0) ? jms.getViewport(0) : null; + // //////////////////////////////// // LOAD SEQUENCES @@ -2614,7 +2620,11 @@ public class Jalview2XML } } - + if (view==null) + { + // only dataset in this model, so just return. + return null; + } // /////////////////////////////// // LOAD VIEWPORT