Returns TreePanel when opening Newick
authoramwaterhouse <Andrew Waterhouse>
Tue, 14 Jun 2005 10:41:00 +0000 (10:41 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 14 Jun 2005 10:41:00 +0000 (10:41 +0000)
src/jalview/gui/AlignFrame.java

index 5c31931..ad350cc 100755 (executable)
@@ -115,7 +115,7 @@ public class AlignFrame
         }\r
 \r
         String choice = chooser.getSelectedFile().getPath();\r
-        Jalview2XML.SaveState(this, choice, shortName);\r
+        Jalview2XML.SaveAlignment(this, choice, shortName);\r
 \r
         // USE Jalview2XML to save this file\r
         return;\r
@@ -1236,7 +1236,6 @@ public class AlignFrame
 \r
   void NewTreePanel(String type, String pwType, String title)\r
   {\r
-    String ltitle;\r
     final TreePanel tp;\r
 \r
     if ( (viewport.getSelectionGroup() != null) &&\r
@@ -1569,7 +1568,7 @@ public class AlignFrame
       {\r
         jalview.io.NewickFile fin = new jalview.io.NewickFile(choice,\r
             "File");\r
-        ShowNewickTree(fin, choice);\r
+        viewport.setCurrentTree( ShowNewickTree(fin, choice).getTree() );\r
       }\r
       catch (Exception ex)\r
       {\r
@@ -1582,27 +1581,27 @@ public class AlignFrame
     }\r
   }\r
 \r
-  public void ShowNewickTree(NewickFile nf, String title)\r
+  public TreePanel ShowNewickTree(NewickFile nf, String title)\r
   {\r
+    TreePanel tp = null;\r
     try\r
     {\r
       nf.parse();\r
-\r
       if (nf.getTree() != null)\r
       {\r
-        TreePanel tp = new TreePanel(viewport,\r
+        tp = new TreePanel(viewport,\r
                                      viewport.getAlignment().getSequences(), nf,\r
                                      "FromFile",\r
                                      title);\r
         Desktop.addInternalFrame(tp, title, 600, 500);\r
         addTreeMenuItem(tp, title);\r
-        viewport.setCurrentTree(tp.getTree());\r
       }\r
     }\r
     catch (Exception ex)\r
     {\r
       ex.printStackTrace();\r
     }\r
+    return tp;\r
   }\r
 \r
   class PrintThread\r