timing of 'on load' output before any gui thread operations
authorjprocter <Jim Procter>
Mon, 30 Jun 2008 09:50:13 +0000 (09:50 +0000)
committerjprocter <Jim Procter>
Mon, 30 Jun 2008 09:50:13 +0000 (09:50 +0000)
src/jalview/io/FileLoader.java

index 3a77b73..584840e 100755 (executable)
@@ -405,15 +405,11 @@ public class FileLoader implements Runnable
     }
     loadtime += System.currentTimeMillis();
 
-    if (Desktop.instance != null)
-    {
-      Desktop.instance.stopLoading();
-    }
     // System.gc();
     memused = memused - (rt.maxMemory() - rt.totalMemory() + rt.freeMemory()); // difference in free memory after load
-    if (alignFrame != null)
+    if (Desktop.desktop != null && Desktop.desktop.isShowMemoryUsage())
     {
-      if (Desktop.desktop != null && Desktop.desktop.isShowMemoryUsage())
+      if (alignFrame != null)
       {
         AlignmentI al = alignFrame.getViewport().getAlignment();
 
@@ -421,8 +417,18 @@ public class FileLoader implements Runnable
                 + (loadtime / 1000.0) + "s, took an additional "
                 + (1.0 * memused / (1024.0 * 1024.0)) + " MB ("
                 + al.getHeight() + " seqs by " + al.getWidth() + " cols)");
+      } else {
+        // report that we didn't load anything probably due to an out of memory error
+        System.out.println("Failed to load '"+title+"' in "
+                + (loadtime / 1000.0) + "s, took an additional "
+                + (1.0 * memused / (1024.0 * 1024.0)) + " MB (alignment is null)");
       }
     }
+    // remove the visual delay indicator
+    if (Desktop.instance != null)
+    {
+      Desktop.instance.stopLoading();
+    }
 
   }