Java Code Examples for com.intellij.openapi.ide.CopyPasteManager#getInstance()
The following examples show how to use
com.intellij.openapi.ide.CopyPasteManager#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditorModificationUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public static Transferable getContentsToPasteToEditor(@Nullable Producer<Transferable> producer) { if (producer == null) { CopyPasteManager manager = CopyPasteManager.getInstance(); return manager.areDataFlavorsAvailable(DataFlavor.stringFlavor) ? manager.getContents() : null; } else { return producer.produce(); } }
Example 2
Source File: EditorModificationUtil.java From consulo with Apache License 2.0 | 5 votes |
private static Transferable getTransferable(Producer<Transferable> producer) { Transferable content = null; if (producer != null) { content = producer.produce(); } else { CopyPasteManager manager = CopyPasteManager.getInstance(); if (manager.areDataFlavorsAvailable(DataFlavor.stringFlavor)) { content = manager.getContents(); } } return content; }
Example 3
Source File: EditorCopyPasteHelperImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nullable @Override public TextRange[] pasteFromClipboard(@Nonnull Editor editor) { CopyPasteManager manager = CopyPasteManager.getInstance(); if (manager.areDataFlavorsAvailable(DataFlavor.stringFlavor)) { Transferable clipboardContents = manager.getContents(); if (clipboardContents != null) { return pasteTransferable(editor, clipboardContents); } } return null; }