Object (@NotNull String dataId) { if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) { return new TextCopyProvider() { @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } @Nullable @Override public Collection<String> getTextLinesToCopy() { TreePath selection = getSelectionPath(); Object value = selection == null ? null : selection.getLastPathComponent(); if (value instanceof MessageNode messageNode) { return Arrays.asList(messageNode.getText()); } return value == null ? null : Collections.singleton(value.toString()); } }; } return null; }