- JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "Couldn't read the pasted text.\n" +\r
- "Formats currently supported are\n" +\r
- "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM",\r
- "Error parsing text",\r
- JOptionPane.WARNING_MESSAGE);\r
+ String format = new IdentifyFile().Identify(getText(), "Paste");\r
+ SequenceI[] sequences = null;\r
+\r
+ if (FormatAdapter.formats.contains(format))\r
+ {\r
+ try{\r
+ sequences = new FormatAdapter().readFile(getText(), "Paste", format);\r
+ }catch(java.io.IOException ex)\r
+ {\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Couldn't read the pasted text.\n" +ex.toString(),\r
+ "Error parsing text",\r
+ JOptionPane.WARNING_MESSAGE);\r
+ }\r
+ }\r
+\r
+ if (sequences != null)\r
+ {\r
+ AlignFrame af = new AlignFrame(new Alignment(sequences));\r
+ af.currentFileFormat = format;\r
+ Desktop.addInternalFrame(af, "Cut & Paste input - " + format,\r
+ AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
+ af.statusBar.setText("Successfully pasted alignment file");\r
+\r
+ try\r
+ {\r
+ af.setMaximum( jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", false));\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+\r
+ try\r
+ {\r
+ this.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r