Merge branch 'test_paolo_JAL-1065' into Tcoffee_JAL-1065
[jalview.git] / src / jalview / appletgui / AlignFrame.java
index 15904df..90b1a05 100644 (file)
@@ -100,7 +100,6 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
 \r
   String jalviewServletURL;\r
   \r
-  TCoffeeScoreFile tcoffeeScoreFile;\r
 \r
   public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet, String title, boolean embedded)\r
   {\r
@@ -998,7 +997,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
       changeColour(new Blosum62ColourScheme());\r
     }\r
     else if (source == tcoffeeColour) {\r
-        changeColour(new TCoffeeColourScheme(tcoffeeScoreFile));\r
+        changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
     }\r
     else if (source == annotationColour)\r
     {\r
@@ -3682,6 +3681,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
          \r
          TCoffeeScoreFile file = TCoffeeScoreFile.load( new InputStreamReader( url.openStream() ) );\r
          if( file == null ) {\r
+        // TODO: raise a dialog box here rather than bomb out.\r
+            \r
                  throw new RuntimeException("The file provided does not match the T-Coffee scores file format");\r
          }\r
          \r
@@ -3690,14 +3691,18 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
           */\r
          AlignmentI aln; \r
          if( (aln=viewport.alignment) != null && (aln.getHeight() != file.getHeight() || aln.getWidth() != file.getWidth()) ) {\r
-                 throw new RuntimeException("The scores matrix does not match the alignment dimensions");\r
+           // TODO: raise a dialog box here rather than bomb out.\r
+           throw new RuntimeException("The scores matrix does not match the alignment dimensions");\r
+                 \r
          }\r
          \r
-         tcoffeeColour.setEnabled(true);\r
-         tcoffeeScoreFile = file;\r
-         \r
-         // switch to this color\r
-         changeColour(new TCoffeeColourScheme(tcoffeeScoreFile));\r
+          // TODO add parameter to indicate if matching should be done\r
+         if (file.annotateAlignment(alignPanel.getAlignment(), false))\r
+         {\r
+                 tcoffeeColour.setEnabled(true);\r
+                 // switch to this color\r
+                 changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
+          }\r
   }\r
   \r
   \r