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;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JProgressBar;
}
});
- // displayed.
// Thread off a new instance of the file chooser - this reduces the time it
// takes to open it later on.
new Thread(new Runnable()
Cache.log.debug("Filechooser init thread started.");
String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT");
JalviewFileChooser.forRead(Cache.getProperty("LAST_DIRECTORY"),
- // jalview.io.AppletFormatAdapter.READABLE_EXTENSIONS,
- // jalview.io.AppletFormatAdapter.READABLE_FNAMES,
- fileFormat, true);
+ fileFormat);
Cache.log.debug("Filechooser init thread finished.");
}
}).start();
}
});
+ desktop.add(frame);
+
windowMenu.add(menuItem);
- desktop.add(frame);
frame.toFront();
try
{
{
String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT");
JalviewFileChooser chooser = JalviewFileChooser.forRead(
- Cache.getProperty("LAST_DIRECTORY"),
- // AppletFormatAdapter.READABLE_EXTENSIONS,
- // AppletFormatAdapter.READABLE_FNAMES,
- fileFormat, true);
+ Cache.getProperty("LAST_DIRECTORY"), fileFormat);
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager
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; //??
}
}
public void saveState_actionPerformed(ActionEvent e)
{
JalviewFileChooser chooser = new JalviewFileChooser(
- Cache.getProperty("LAST_DIRECTORY"), "jvp", "Jalview Project",
- "Jalview Project");
+ Cache.getProperty("LAST_DIRECTORY"), "jvp", "Jalview Project");
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager.getString("label.save_state"));
{
JalviewFileChooser chooser = new JalviewFileChooser(
Cache.getProperty("LAST_DIRECTORY"), "vdj",// TODO: VAMSAS DOCUMENT EXTENSION is VDJ
- "Vamsas Document", "Vamsas Document");
+ "Vamsas Document");
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager