Check selection size before making tree
authoramwaterhouse <Andrew Waterhouse>
Thu, 10 Aug 2006 14:57:40 +0000 (14:57 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 10 Aug 2006 14:57:40 +0000 (14:57 +0000)
src/jalview/appletgui/AlignFrame.java

index 6592399..d72c665 100755 (executable)
@@ -1597,7 +1597,8 @@ public void itemStateChanged(ItemEvent evt)
 \r
   public void pairwiseAlignmentMenuItem_actionPerformed()\r
   {\r
-    if (viewport.getSelectionGroup().getSize(false) > 1)\r
+    if (viewport.getSelectionGroup()!=null\r
+        && viewport.getSelectionGroup().getSize(false) > 1)\r
     {\r
       Frame frame = new Frame();\r
       frame.add(new PairwiseAlignPanel(alignPanel));\r
@@ -1686,13 +1687,19 @@ public void itemStateChanged(ItemEvent evt)
 \r
     }\r
 \r
-    final TreePanel tp = new TreePanel(viewport,\r
-                         type,\r
-                         pwType);\r
+    if ( (viewport.getSelectionGroup() != null &&\r
+          viewport.getSelectionGroup().getSize(false) > 1)\r
+      || (viewport.getSelectionGroup() == null\r
+          && viewport.alignment.getHeight() > 1))\r
+    {\r
+      final TreePanel tp = new TreePanel(viewport,\r
+                                         type,\r
+                                         pwType);\r
 \r
-    addTreeMenuItem(tp, title);\r
+      addTreeMenuItem(tp, title);\r
 \r
-    jalview.bin.JalviewLite.addFrame(tp, title, 600, 500);\r
+      jalview.bin.JalviewLite.addFrame(tp, title, 600, 500);\r
+    }\r
   }\r
 \r
   void loadTree_actionPerformed()\r