Designer implements ClipboardOwner { private void copyXmlToClipboard() { String xml = getXmlTreeCode(); if (xml != null) { Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(xml), this); } } Designer(String[] args); static void main(String[] args); @Override void lostOwnership(Clipboard clipboard, Transferable contents);  }
@Test public void testCopyXmlToClipboard() { Node compilationUnit = Designer.getCompilationUnit( LanguageRegistry.getLanguage(DummyLanguageModule.NAME).getDefaultVersion().getLanguageVersionHandler(), "doesn't matter"); String xml = Designer.getXmlTreeCode(compilationUnit); assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<dummyNode BeginColumn=\"1\" BeginLine=\"1\" EndColumn=\"0\" EndLine=\"0\" FindBoundary=\"false\"\n" + " Image=\"Foo\"\n" + " SingleLine=\"false\"/>", xml); }