void (@NotNull DataContext dataContext) { try { final Clipboard clipboard = myTree.getToolkit().getSystemClipboard(); myTree.getTransferHandler().exportToClipboard(myTree, clipboard, TransferHandler.COPY); } catch(Exception ex) { // probably don't have clipboard access or something LOG.info(ex); } }