+ String format = new IdentifyFile().Identify(getText(), "Paste");\r
+ SequenceI[] sequences = null;\r
+\r
+ if (FormatAdapter.isValidFormat(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
+ if(viewport!=null)\r
+ {\r
+ for(int i=0; i<sequences.length; i++)\r
+ viewport.getAlignment().addSequence(sequences[i]);\r
+\r
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());\r
+ }\r
+ else\r
+ {\r
+ AlignFrame af = new AlignFrame(new Alignment(sequences),\r
+ AlignFrame.DEFAULT_WIDTH,\r
+ AlignFrame.DEFAULT_HEIGHT);\r
+ af.currentFileFormat = format;\r
+ Desktop.addInternalFrame(af, "Cut & Paste input - " + format,\r
+ AlignFrame.DEFAULT_WIDTH,\r
+ AlignFrame.DEFAULT_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
+ }\r