spelling err
[jalview.git] / src / jalview / io / FileLoader.java
index 5996d98..a3ef237 100755 (executable)
@@ -1,3 +1,22 @@
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+*/\r
+\r
 package jalview.io;\r
 \r
 import jalview.gui.AlignFrame;\r
@@ -55,13 +74,20 @@ public class FileLoader
 \r
     if (format.equalsIgnoreCase("Jalview"))\r
     {\r
-      af = Jalview2XML.LoadJalviewAlign(file);\r
+      af = new Jalview2XML().LoadJalviewAlign(file);\r
     }\r
     else\r
     {\r
+      String errorMessage = AppletFormatAdapter.SUPPORTED_FORMATS;\r
+\r
       if (FormatAdapter.formats.contains(format))\r
       {\r
-        sequences = FormatAdapter.readFile(file, protocol, format);\r
+        try{\r
+          sequences = new FormatAdapter().readFile(file, protocol, format);\r
+        }catch(java.io.IOException ex)\r
+        {\r
+          errorMessage = ex.getMessage();\r
+        }\r
       }\r
 \r
       if ( (sequences != null) && (sequences.length > 0))\r
@@ -85,10 +111,9 @@ public class FileLoader
       else\r
       {\r
         JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
-                                              "Couldn't open file.\n" +\r
-                                              "Formats currently supported are\n" +\r
-                                              "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM" // JBPNote - message should be generated through FormatAdapter!\r
-                                              , "Error loading file",\r
+                                              "Couldn't load file "+file+"\n"\r
+                                              +errorMessage,\r
+                                              "Error loading file",\r
                                               JOptionPane.WARNING_MESSAGE);\r
       }\r
     }\r