JAL-4206 Use All Known Alignment Files as default until a file is loaded
[jalview.git] / src / jalview / io / FileLoader.java
index 971aba3..9ede0f5 100755 (executable)
@@ -74,6 +74,8 @@ public class FileLoader implements Runnable
 
   private File selectedFile;
 
+  private static boolean useDefaultFileFormat = false;
+
   /**
    * default constructor always raised errors in GUI dialog boxes
    */
@@ -332,7 +334,8 @@ public class FileLoader implements Runnable
                   MessageManager.getString("label.couldnt_read_data"),
                   JvOptionPane.WARNING_MESSAGE);
         }
-        this.setShouldBeSaved();
+        // don't set shouldBeSaved if didn't load anything
+        // this.setShouldBeSaved();
         return;
       }
       // TODO: cache any stream datasources as a temporary file (eg. PDBs
@@ -641,6 +644,8 @@ public class FileLoader implements Runnable
     }
 
     this.setShouldBeSaved();
+    // after first file loaded we revert to assuming a default file format
+    useDefaultFileFormat = true;
   }
 
   /**
@@ -683,4 +688,9 @@ public class FileLoader implements Runnable
             QuitHandler.Message.UNSAVED_ALIGNMENTS);
   }
 
+  public static boolean getUseDefaultFileFormat()
+  {
+    return useDefaultFileFormat;
+  }
+
 }