import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SequenceI;
+import jalview.io.AlignmentFileI;
import jalview.io.AppletFormatAdapter;
-import jalview.io.FileParse;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormatException;
+import jalview.io.FileFormatI;
import jalview.io.FormatAdapter;
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
AlignViewportI viewport;
- FileParse source = null;
+ AlignmentFileI source = null;
public CutAndPasteTransfer()
{
return;
}
- String format = new IdentifyFile().identify(text, "Paste");
- if (format == null || format.equalsIgnoreCase("EMPTY DATA FILE"))
+ FileFormatI format = null;
+ try
+ {
+ format = new IdentifyFile().identify(text, DataSourceType.PASTE);
+ } catch (FileFormatException e1)
+ {
+ // leave as null
+ }
+ if (format == null)
{
System.err.println(MessageManager
.getString("label.couldnt_read_data"));
if (!Jalview.isHeadlessMode())
{
- javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
AppletFormatAdapter.SUPPORTED_FORMATS,
MessageManager.getString("label.couldnt_read_data"),
JOptionPane.WARNING_MESSAGE);
// TODO: identify feature, annotation or tree file and parse appropriately.
AlignmentI al = null;
- if (FormatAdapter.isValidFormat(format))
+ try
{
- try
- {
- FormatAdapter fa = new FormatAdapter(alignpanel);
- al = fa.readFile(getText(), "Paste", format);
- source = fa.getAlignFile();
+ FormatAdapter fa = new FormatAdapter(alignpanel);
+ al = fa.readFile(getText(), DataSourceType.PASTE, format);
+ source = fa.getAlignFile();
- } catch (java.io.IOException ex)
- {
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- MessageManager.formatMessage(
- "label.couldnt_read_pasted_text",
- new String[] { ex.toString() }), MessageManager
- .getString("label.error_parsing_text"),
- JOptionPane.WARNING_MESSAGE);
- }
+ } catch (java.io.IOException ex)
+ {
+ JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
+ .formatMessage("label.couldnt_read_pasted_text", new String[]
+ { ex.toString() }), MessageManager
+ .getString("label.error_parsing_text"),
+ JOptionPane.WARNING_MESSAGE);
}
if (al != null && al.hasValidSequence())
{
String title = MessageManager.formatMessage(
- "label.input_cut_paste_params", new String[] { format });
+ "label.input_cut_paste_params",
+ new String[] { format.toString() });
FeatureSettingsModelI proxyColourScheme = source
.getFeatureColourScheme();