X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FCutAndPasteTransfer.java;h=8b21058f8802b0a891a164ef94198439840c7b9e;hb=4815037f13748676b04b91dc761b73cf6f2d6ecd;hp=7b3e43874319ede3697f6b17f27b1fca6d88e6a2;hpb=ee198b3ca3687f18a2ee186f4e7c7330f4ea30f0;p=jalview.git diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index 7b3e438..8b21058 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -30,10 +30,11 @@ import jalview.bin.Jalview; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.SequenceI; +import jalview.io.AlignmentFileI; import jalview.io.AppletFormatAdapter; import jalview.io.DataSourceType; +import jalview.io.FileFormatException; import jalview.io.FileFormatI; -import jalview.io.FileParse; import jalview.io.FormatAdapter; import jalview.io.IdentifyFile; import jalview.io.JalviewFileChooser; @@ -70,7 +71,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer AlignViewportI viewport; - FileParse source = null; + AlignmentFileI source = null; public CutAndPasteTransfer() { @@ -215,8 +216,14 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer return; } - FileFormatI format = new IdentifyFile().identify(text, - DataSourceType.PASTE); + FileFormatI format = null; + try + { + format = new IdentifyFile().identify(text, DataSourceType.PASTE); + } catch (FileFormatException e1) + { + // leave as null + } if (format == null) { System.err.println(MessageManager @@ -234,29 +241,26 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer // 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(), DataSourceType.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();