JAL-2344 FileFormats singleton for formats, FileFormatI simplified
[jalview.git] / src / jalview / io / FileLoader.java
index 3ad74c7..f137395 100755 (executable)
@@ -237,7 +237,7 @@ public class FileLoader implements Runnable
 
     if (protocol == DataSourceType.FILE)
     {
-      Cache.setProperty("DEFAULT_FILE_FORMAT", format.toString());
+      Cache.setProperty("DEFAULT_FILE_FORMAT", format.getName());
     }
   }
 
@@ -279,7 +279,7 @@ public class FileLoader implements Runnable
                   Desktop.desktop,
                   MessageManager.getString("label.couldnt_read_data")
                           + " in " + file + "\n"
-                          + AppletFormatAdapter.SUPPORTED_FORMATS,
+                          + AppletFormatAdapter.getSupportedFormats(),
                   MessageManager.getString("label.couldnt_read_data"),
                   JvOptionPane.WARNING_MESSAGE);
         }
@@ -311,27 +311,27 @@ public class FileLoader implements Runnable
       }
       else
       {
-        String error = AppletFormatAdapter.SUPPORTED_FORMATS;
-          try
+        String error = AppletFormatAdapter.getSupportedFormats();
+        try
+        {
+          if (source != null)
           {
-            if (source != null)
-            {
-              // read from the provided source
+            // read from the provided source
             al = new FormatAdapter().readFromFile(source, format);
-            }
-            else
-            {
-
-              // open a new source and read from it
-              FormatAdapter fa = new FormatAdapter();
-              al = fa.readFile(file, protocol, format);
-              source = fa.getAlignFile(); // keep reference for later if
-                                          // necessary.
-            }
-          } catch (java.io.IOException ex)
+          }
+          else
           {
-            error = ex.getMessage();
+
+            // open a new source and read from it
+            FormatAdapter fa = new FormatAdapter();
+            al = fa.readFile(file, protocol, format);
+            source = fa.getAlignFile(); // keep reference for later if
+                                        // necessary.
           }
+        } catch (java.io.IOException ex)
+        {
+          error = ex.getMessage();
+        }
 
         if ((al != null) && (al.getHeight() > 0) && al.hasValidSequence())
         {