JAL-2798 added != null check for Aptx trees
[jalview.git] / src / jalview / gui / Jalview2XML.java
index abb9fa7..c0246c3 100644 (file)
@@ -1115,7 +1115,9 @@ public class Jalview2XML
         try
         {
           tree.writeToXml(new File("word"));
-          copyFileToJar(jout, "word", tree.getTreeName());
+          copyFileToJar(jout, "word", "aptx-test");
+
+
         } catch (IOException e)
         {
           // TODO Auto-generated catch block
@@ -1127,6 +1129,7 @@ public class Jalview2XML
     }
 
 
+
     // SAVE ANNOTATIONS
     /**
      * store forward refs from an annotationRow to any groups
@@ -3560,12 +3563,33 @@ public class Jalview2XML
     if (loadTreesAndStructures)
     {
       loadTrees(jms, view, af, av, ap);
+      loadExternalTrees(jprovider, jms, av);
       loadPDBStructures(jprovider, jseqs, af, ap);
       loadRnaViewers(jprovider, jseqs, ap);
     }
     // and finally return.
     return af;
   }
+    
+  private void loadExternalTrees(jarInputStreamProvider jprovider,
+          JalviewModelSequence jms, AlignViewport av)
+  {
+    String treeFile = copyJarEntry(jprovider, "aptx-test", "aptx", null);
+    if (treeFile != null)
+    {
+    try
+    {
+      AptxInit.createInstancesFromFile(treeFile, av);
+    } catch (IOException e)
+    {
+      // TODO Auto-generated catch block
+      e.printStackTrace();
+      }
+    }
+    
+  }
+
+
 
   /**
    * Instantiate and link any saved RNA (Varna) viewers. The state of the Varna