本文整理汇总了Java中com.intellij.ide.dnd.FileCopyPasteUtil.isFileListFlavorSupported方法的典型用法代码示例。如果您正苦于以下问题:Java FileCopyPasteUtil.isFileListFlavorSupported方法的具体用法?Java FileCopyPasteUtil.isFileListFlavorSupported怎么用?Java FileCopyPasteUtil.isFileListFlavorSupported使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.dnd.FileCopyPasteUtil
的用法示例。
在下文中一共展示了FileCopyPasteUtil.isFileListFlavorSupported方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProjectPath
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Nullable
private static String getProjectPath(final TransferSupport support) {
if (!FileCopyPasteUtil.isFileListFlavorSupported(support.getDataFlavors())) return null;
List<File> files = FileCopyPasteUtil.getFileList(support.getTransferable());
if (files == null) return null;
File file = ContainerUtil.getFirstItem(files);
return file != null && isProjectFileOrDir(file) ? file.getAbsolutePath() : null;
}
示例2: handleDrop
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
public void handleDrop(@NotNull final Transferable t, @Nullable final Project project, EditorWindow editorWindow) {
if (project == null || !FileCopyPasteUtil.isFileListFlavorSupported(t)) {
return;
}
final List<File> fileList = FileCopyPasteUtil.getFileList(t);
if (fileList != null) {
openFiles(project, fileList, editorWindow);
}
}
示例3: canImport
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
public boolean canImport(final TransferSupport support) {
return FileCopyPasteUtil.isFileListFlavorSupported(support.getDataFlavors());
}
示例4: canHandleDrop
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
public boolean canHandleDrop(final DataFlavor[] transferFlavors) {
return transferFlavors != null && FileCopyPasteUtil.isFileListFlavorSupported(transferFlavors);
}
示例5: update
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public boolean update(DnDEvent event) {
event.setDropPossible(false, "");
final Object attached = event.getAttachedObject();
final int dropAction = event.getAction().getActionId();
final DropHandler dropHandler = getDropHandler(dropAction);
final TreeNode[] sourceNodes = getSourceNodes(attached);
final Point point = event.getPoint();
final TreeNode targetNode = getTargetNode(point);
if (targetNode == null || (dropAction & DnDConstants.ACTION_COPY_OR_MOVE) == 0) {
return false;
}
else if (sourceNodes == null && !FileCopyPasteUtil.isFileListFlavorSupported(event)) {
return false;
}
else if (sourceNodes != null && ArrayUtilRt.find(sourceNodes, targetNode) != -1) {
return false;
}
else if (sourceNodes != null && !dropHandler.isValidSource(sourceNodes, targetNode)) {
return false;
}
if (sourceNodes != null) {
boolean redundant = true;
for (TreeNode sourceNode : sourceNodes) {
if (!dropHandler.isDropRedundant(sourceNode, targetNode)) {
redundant = false;
break;
}
}
if (redundant) return false;
}
else {
// it seems like it's not possible to obtain dragged items _before_ accepting _drop_ on Macs, so just skip this check
if (!SystemInfo.isMac) {
final PsiFileSystemItem[] psiFiles = getPsiFiles(FileCopyPasteUtil.getFileListFromAttachedObject(attached));
if (psiFiles == null || psiFiles.length == 0) return false;
if (!MoveHandler.isValidTarget(getPsiElement(targetNode), psiFiles)) return false;
}
}
final Rectangle pathBounds = myTree.getPathBounds(myTree.getClosestPathForLocation(point.x, point.y));
event.setHighlighting(new RelativeRectangle(myTree, pathBounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
event.setDropPossible(true);
return false;
}
示例6: isPasteEnabled
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public boolean isPasteEnabled(@NotNull DataContext dataContext) {
final Transferable contents = CopyPasteManager.getInstance().getContents();
final IdeView ideView = LangDataKeys.IDE_VIEW.getData(dataContext);
return contents != null && FileCopyPasteUtil.isFileListFlavorSupported(contents) && ideView != null;
}
示例7: canImport
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public boolean canImport(final TransferSupport support) {
return FileCopyPasteUtil.isFileListFlavorSupported(support.getDataFlavors());
}