+ String format = new IdentifyFile().Identify(getText(), "Paste");\r
+ Alignment al = null;\r
+\r
+ if (FormatAdapter.isValidFormat(format))\r
+ {\r
+ try{\r
+ al = 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 (al != null)\r
+ {\r
+ if(viewport!=null)\r
+ {\r
+ for(int i=0; i<al.getHeight(); i++)\r
+ viewport.getAlignment().addSequence(al.getSequenceAt(i));\r
+\r
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());\r
+ }\r
+ else\r
+ {\r
+ AlignFrame af = new AlignFrame(al,\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