+ if (FormatAdapter.isValidFormat(format))
+ {
+ try
+ {
+ FormatAdapter fa = new FormatAdapter(alignpanel);
+ al = fa.readFile(getText(), "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);
+ }
+ }
+
+ if (al != null && al.hasValidSequence())
+ {
+ String title = MessageManager.formatMessage(
+ "label.input_cut_paste_params", new String[] { format });
+ /*
+ * if the view panel was closed its alignment is nulled
+ * and this is an orphaned cut and paste window
+ */
+ if (viewport != null && viewport.getAlignment() != null)
+ {
+ ((AlignViewport) viewport).addAlignment(al, title);
+ }
+ else
+ {
+
+ AlignFrame af;
+ if (source instanceof ComplexAlignFile)
+ {
+ ColumnSelection colSel = ((ComplexAlignFile) source)
+ .getColumnSelection();
+ SequenceI[] hiddenSeqs = ((ComplexAlignFile) source)
+ .getHiddenSequences();
+ boolean showSeqFeatures = ((ComplexAlignFile) source)
+ .isShowSeqFeatures();
+ String colourSchemeName = ((ComplexAlignFile) source)
+ .getGlobalColourScheme();
+ FeaturesDisplayedI fd = ((ComplexAlignFile) source)
+ .getDisplayedFeatures();
+ af = new AlignFrame(al, hiddenSeqs, colSel,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ af.getViewport().setShowSequenceFeatures(showSeqFeatures);
+ af.getViewport().setFeaturesDisplayed(fd);
+ ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme(
+ colourSchemeName, al);
+ if (cs != null)
+ {
+ af.changeColour(cs);
+ }
+ }
+ else