Merge branch 'develop' into features/JAL-892varnaToProject
[jalview.git] / src / jalview / io / FileLoader.java
index b11dfd5..3aded05 100755 (executable)
@@ -21,6 +21,8 @@
 package jalview.io;
 
 import jalview.api.ComplexAlignFile;
+import jalview.api.FeaturesDisplayedI;
+import jalview.bin.Jalview;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.ColumnSelection;
 import jalview.datamodel.PDBEntry;
@@ -256,6 +258,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)
@@ -356,11 +373,14 @@ public class FileLoader implements Runnable
                       .isShowSeqFeatures();
               ColourSchemeI cs = ((ComplexAlignFile) source)
                       .getColourScheme();
+              FeaturesDisplayedI fd = ((ComplexAlignFile) source)
+                      .getDisplayedFeatures();
               alignFrame = new AlignFrame(al, hiddenSeqs, colSel,
                       AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
 
               alignFrame.getViewport().setShowSequenceFeatures(
                       showSeqFeatures);
+              alignFrame.getViewport().setFeaturesDisplayed(fd);
               alignFrame.changeColour(cs);
             }
             else