import jalview.io.FileFormat;
import jalview.io.FileFormatException;
import jalview.io.FileFormatI;
+import jalview.io.FileFormats;
import jalview.io.FileLoader;
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
Cache.setProperty("LAST_DIRECTORY", chooser
.getSelectedFile().getParent());
- FileFormatI format = null;
- FileFormatI selectedFormat = chooser.getSelectedFormat();
- if (FileFormat.Jalview.equals(selectedFormat))
- {
- format = FileFormat.Jalview;
- }
- else
+ FileFormatI format = chooser.getSelectedFormat();
+
+ /*
+ * Call IdentifyFile to verify the file contains what its extension implies.
+ * Skip this step for dynamically added file formats, because
+ * IdentifyFile does not know how to recognise them.
+ */
+ if (FileFormats.getInstance().isIdentifiable(format))
{
try
{
format = new IdentifyFile().identify(choice, DataSourceType.FILE);
} catch (FileFormatException e)
{
- // format is null
+ // format = null; //??
}
}
@Override
public void saveState_actionPerformed(ActionEvent e)
{
- JalviewFileChooser chooser = new JalviewFileChooser(
- Cache.getProperty("LAST_DIRECTORY"), "jvp", "Jalview Project");
+ JalviewFileChooser chooser = new JalviewFileChooser("jvp",
+ "Jalview Project");
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager.getString("label.save_state"));
{
if (v_client != null)
{
- JalviewFileChooser chooser = new JalviewFileChooser(
- Cache.getProperty("LAST_DIRECTORY"), "vdj",// TODO: VAMSAS DOCUMENT EXTENSION is VDJ
+ // TODO: VAMSAS DOCUMENT EXTENSION is VDJ
+ JalviewFileChooser chooser = new JalviewFileChooser("vdj",
"Vamsas Document");
chooser.setFileView(new JalviewFileView());