本文整理汇总了Java中com.intellij.openapi.ide.CopyPasteManager.areDataFlavorsAvailable方法的典型用法代码示例。如果您正苦于以下问题:Java CopyPasteManager.areDataFlavorsAvailable方法的具体用法?Java CopyPasteManager.areDataFlavorsAvailable怎么用?Java CopyPasteManager.areDataFlavorsAvailable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ide.CopyPasteManager
的用法示例。
在下文中一共展示了CopyPasteManager.areDataFlavorsAvailable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContentsToPasteToEditor
import com.intellij.openapi.ide.CopyPasteManager; //导入方法依赖的package包/类
@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();
}
}
示例2: getTransferable
import com.intellij.openapi.ide.CopyPasteManager; //导入方法依赖的package包/类
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;
}
示例3: pasteFromClipboard
import com.intellij.openapi.ide.CopyPasteManager; //导入方法依赖的package包/类
@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;
}