Merge branch 'test_paolo_JAL-1065' into Tcoffee_JAL-1065
[jalview.git] / src / jalview / appletgui / AlignFrame.java
index cc2c966..90b1a05 100644 (file)
@@ -2334,7 +2334,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
         {\r
           try\r
           {\r
-            sg.cs = (ColourSchemeI) cs.getClass().newInstance();\r
+            sg.cs = cs.getClass().newInstance();\r
           } catch (Exception ex)\r
           {\r
             ex.printStackTrace();\r
@@ -3681,16 +3681,28 @@ 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
-         // TODO add parameter to indicate if matching should be done\r
+         \r
+         /*\r
+          * check that the score matrix matches the alignment dimensions\r
+          */\r
+         AlignmentI aln; \r
+         if( (aln=viewport.alignment) != null && (aln.getHeight() != file.getHeight() || aln.getWidth() != file.getWidth()) ) {\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
+          // 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
   \r