Search in sources :

Example 1 with TextBlockTransferableData

use of com.intellij.codeInsight.editorActions.TextBlockTransferableData in project intellij-community by JetBrains.

the class EditorCopyPasteHelperImpl method copySelectionToClipboard.

@Override
public void copySelectionToClipboard(@NotNull Editor editor) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    List<TextBlockTransferableData> extraData = new ArrayList<>();
    String s = editor.getCaretModel().supportsMultipleCarets() ? getSelectedTextForClipboard(editor, extraData) : editor.getSelectionModel().getSelectedText();
    if (s == null)
        return;
    s = TextBlockTransferable.convertLineSeparators(s, "\n", extraData);
    Transferable contents = editor.getCaretModel().supportsMultipleCarets() ? new TextBlockTransferable(s, extraData, null) : new StringSelection(s);
    CopyPasteManager.getInstance().setContents(contents);
}
Also used : TextBlockTransferable(com.intellij.codeInsight.editorActions.TextBlockTransferable) ArrayList(java.util.ArrayList) TextBlockTransferableData(com.intellij.codeInsight.editorActions.TextBlockTransferableData) Transferable(java.awt.datatransfer.Transferable) TextBlockTransferable(com.intellij.codeInsight.editorActions.TextBlockTransferable) StringSelection(java.awt.datatransfer.StringSelection)

Aggregations

TextBlockTransferable (com.intellij.codeInsight.editorActions.TextBlockTransferable)1 TextBlockTransferableData (com.intellij.codeInsight.editorActions.TextBlockTransferableData)1 StringSelection (java.awt.datatransfer.StringSelection)1 Transferable (java.awt.datatransfer.Transferable)1 ArrayList (java.util.ArrayList)1