JAL-1807 explicit imports (jalview.io.*)
[jalview.git] / src / jalview / io / FileLoader.java
index 18ab642..1edf832 100755 (executable)
@@ -22,6 +22,8 @@ package jalview.io;
 
 import jalview.api.ComplexAlignFile;
 import jalview.api.FeaturesDisplayedI;
+import jalview.bin.Cache;
+import jalview.bin.Jalview;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.ColumnSelection;
 import jalview.datamodel.PDBEntry;
@@ -198,7 +200,7 @@ public class FileLoader implements Runnable
     String type = protocol.equals(FormatAdapter.FILE) ? "RECENT_FILE"
             : "RECENT_URL";
 
-    String historyItems = jalview.bin.Cache.getProperty(type);
+    String historyItems = Cache.getProperty(type);
 
     StringTokenizer st;
 
@@ -224,11 +226,11 @@ public class FileLoader implements Runnable
       newHistory.append(recent.elementAt(i));
     }
 
-    jalview.bin.Cache.setProperty(type, newHistory.toString());
+    Cache.setProperty(type, newHistory.toString());
 
     if (protocol.equals(FormatAdapter.FILE))
     {
-      jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", format);
+      Cache.setProperty("DEFAULT_FILE_FORMAT", format);
     }
   }
 
@@ -257,6 +259,21 @@ public class FileLoader implements Runnable
         {
           format = new IdentifyFile().Identify(file, protocol);
         }
+
+      }
+
+      if (format == null || format.equalsIgnoreCase("EMPTY DATA FILE"))
+      {
+        Desktop.instance.stopLoading();
+        System.err.println("The input file \"" + file
+                + "\" has no data content!");
+        if (!Jalview.isHeadlessMode())
+        {
+          JOptionPane.showMessageDialog(null, "The input file \""
+                  + file + "\" has no data content!", "Empty data file",
+                  JOptionPane.ERROR_MESSAGE);
+        }
+        return;
       }
       // TODO: cache any stream datasources as a temporary file (eg. PDBs
       // retrieved via URL)
@@ -395,7 +412,7 @@ public class FileLoader implements Runnable
 
             try
             {
-              alignFrame.setMaximum(jalview.bin.Cache.getDefault(
+              alignFrame.setMaximum(Cache.getDefault(
                       "SHOW_FULLSCREEN", false));
             } catch (java.beans.PropertyVetoException ex)
             {