Put transparency back
[jalview.git] / src / jalview / io / FileLoader.java
index 3aaba9e..dc18cb7 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+* Copyright (C) 2006 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
@@ -122,8 +122,12 @@ public class FileLoader
     AlignFrame af;\r
 \r
 \r
+\r
     public void run()\r
     {\r
+      if (Desktop.instance != null)\r
+        Desktop.instance.startLoading(file);\r
+\r
       SequenceI[] sequences = null;\r
 \r
       if (format.equalsIgnoreCase("Jalview"))\r
@@ -132,9 +136,9 @@ public class FileLoader
       }\r
       else\r
       {\r
-        String errorMessage = AppletFormatAdapter.SUPPORTED_FORMATS;\r
+        String error = AppletFormatAdapter.SUPPORTED_FORMATS;\r
 \r
-        if (FormatAdapter.formats.contains(format))\r
+        if (FormatAdapter.isValidFormat(format))\r
         {\r
           try\r
           {\r
@@ -142,7 +146,7 @@ public class FileLoader
           }\r
           catch (java.io.IOException ex)\r
           {\r
-            errorMessage = ex.getMessage();\r
+            error = ex.getMessage();\r
           }\r
         }\r
 \r
@@ -172,16 +176,24 @@ public class FileLoader
             {\r
             }\r
           }\r
-\r
         }\r
         else\r
         {\r
-          JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
-                                                "Couldn't load file " + file +\r
-                                                "\n"\r
-                                                + errorMessage,\r
-                                                "Error loading file",\r
-                                                JOptionPane.WARNING_MESSAGE);\r
+          if (Desktop.instance != null)\r
+            Desktop.instance.stopLoading();\r
+\r
+          final String errorMessage = "Couldn't load file "+file+"\n"+error;\r
+\r
+          javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+          {\r
+            public void run()\r
+            {\r
+              JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                                    errorMessage,\r
+                                                    "Error loading file",\r
+                                                    JOptionPane.WARNING_MESSAGE);\r
+            }\r
+          });\r
         }\r
       }\r
 \r
@@ -189,6 +201,10 @@ public class FileLoader
       {\r
         updateRecentlyOpened();\r
       }\r
+\r
+      if (Desktop.instance != null)\r
+        Desktop.instance.stopLoading();\r
+\r
     }\r
   }\r
 \r