JOptionPanes launched in new thread
[jalview.git] / src / jalview / gui / Jalview2XML_V1.java
index 1e479fb..b347864 100755 (executable)
@@ -80,7 +80,7 @@ public class Jalview2XML_V1
      *\r
      * @param file DOCUMENT ME!\r
      */\r
-    public AlignFrame LoadJalviewAlign(String file)\r
+    public AlignFrame LoadJalviewAlign(final String file)\r
     {\r
 \r
         jalview.gui.AlignFrame af = null;\r
@@ -132,39 +132,51 @@ public class Jalview2XML_V1
 \r
                     object = (JalviewModel) object.unmarshal(in);\r
 \r
-                    af = LoadFromObject(object);\r
+                    af = LoadFromObject(object, file);\r
                     entryCount++;\r
                 }\r
             }\r
             while (jarentry != null);\r
         }\r
-        catch(java.net.UnknownHostException ex)\r
+        catch (final java.net.UnknownHostException ex)\r
         {\r
           ex.printStackTrace();\r
-          System.err.println("Couldn't locate Jalview XML file : " +\r
-              ex + "\n");\r
-           JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
-                                    "Couldn't locate " + file,\r
-                                    "URL not found",\r
-                                    JOptionPane.WARNING_MESSAGE);\r
+          javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+          {\r
+            public void run()\r
+            {\r
 \r
+              System.err.println("Couldn't locate Jalview XML file : " +\r
+                                 ex + "\n");\r
+              JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                                    "Couldn't locate " + file,\r
+                                                    "URL not found",\r
+                                                    JOptionPane.WARNING_MESSAGE);\r
+            }\r
+          });\r
         }\r
         catch (Exception ex)\r
         {\r
           ex.printStackTrace();\r
-            System.err.println("Exception whilst loading jalview XML file : " +\r
-                ex + "\n");\r
-             JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
-                                      "Error loading  " + file,\r
-                                      "Error loading Jalview file",\r
-                                      JOptionPane.WARNING_MESSAGE);\r
+          System.err.println("Exception whilst loading jalview XML file : " +\r
+                             ex + "\n");\r
+          javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+          {\r
+            public void run()\r
+            {\r
 \r
+              JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                  "Error loading  " + file,\r
+                  "Error loading Jalview file",\r
+                  JOptionPane.WARNING_MESSAGE);\r
+            }\r
+          });\r
         }\r
 \r
         return af;\r
     }\r
 \r
-    AlignFrame LoadFromObject(JalviewModel object)\r
+    AlignFrame LoadFromObject(JalviewModel object, String file)\r
     {\r
         Vector seqids = new Vector();\r
         SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);\r
@@ -268,6 +280,8 @@ public class Jalview2XML_V1
 \r
         AlignFrame af = new AlignFrame(al, view.getWidth(), view.getHeight());\r
 \r
+        af.setFileName(file, "Jalview");\r
+\r
         for (int i = 0; i < JSEQ.length; i++)\r
         {\r
           af.viewport.setSequenceColour(\r