本文整理汇总了Java中com.intellij.ide.dnd.FileCopyPasteUtil.getFileList方法的典型用法代码示例。如果您正苦于以下问题:Java FileCopyPasteUtil.getFileList方法的具体用法?Java FileCopyPasteUtil.getFileList怎么用?Java FileCopyPasteUtil.getFileList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.dnd.FileCopyPasteUtil
的用法示例。
在下文中一共展示了FileCopyPasteUtil.getFileList方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleDrop
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public void handleDrop(@NotNull final Transferable t, @Nullable final Project project, EditorWindow editorWindow) {
if (project != null) {
final List<File> fileList = FileCopyPasteUtil.getFileList(t);
if (fileList != null) {
openFiles(project, fileList, editorWindow);
}
}
}
示例2: performPaste
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public void performPaste(@NotNull DataContext dataContext) {
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
final IdeView ideView = LangDataKeys.IDE_VIEW.getData(dataContext);
if (project == null || ideView == null) return;
if (!FileCopyPasteUtil.isFileListFlavorAvailable()) return;
final Transferable contents = CopyPasteManager.getInstance().getContents();
if (contents == null) return;
final List<File> fileList = FileCopyPasteUtil.getFileList(contents);
if (fileList == null) return;
final List<PsiElement> elements = new ArrayList<PsiElement>();
for (File file : fileList) {
final VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
if (vFile != null) {
final PsiManager instance = PsiManager.getInstance(project);
PsiFileSystemItem item = vFile.isDirectory() ? instance.findDirectory(vFile) : instance.findFile(vFile);
if (item != null) {
elements.add(item);
}
}
}
if (elements.size() > 0) {
final PsiDirectory dir = ideView.getOrChooseDirectory();
if (dir != null) {
final boolean move = LinuxDragAndDropSupport.isMoveOperation(contents);
if (move) {
new MoveFilesOrDirectoriesHandler().doMove(PsiUtilCore.toPsiElementArray(elements), dir);
}
else {
new CopyFilesOrDirectoriesHandler().doCopy(PsiUtilCore.toPsiElementArray(elements), dir);
}
}
}
}
示例3: importData
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public boolean importData(final TransferSupport support) {
if (canImport(support)) {
List<VirtualFile> pomFiles = new ArrayList<VirtualFile>();
final List<File> fileList = FileCopyPasteUtil.getFileList(support.getTransferable());
if (fileList == null) return false;
MavenProjectsManager manager = MavenProjectsManager.getInstance(myProject);
for (File file : fileList) {
VirtualFile virtualFile = VfsUtil.findFileByIoFile(file, true);
if (file.isFile()
&& virtualFile != null
&& MavenActionUtil.isMavenProjectFile(virtualFile)
&& !manager.isManagedFile(virtualFile)) {
pomFiles.add(virtualFile);
}
}
if (pomFiles.isEmpty()) {
return false;
}
manager.addManagedFilesOrUnignore(pomFiles);
return true;
}
return false;
}
示例4: getAntFiles
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
private VirtualFile[] getAntFiles(final TransferSupport support) {
List<VirtualFile> virtualFileList = new ArrayList<VirtualFile>();
final List<File> fileList = FileCopyPasteUtil.getFileList(support.getTransferable());
if (fileList != null) {
for (File file : fileList ) {
ContainerUtil.addIfNotNull(virtualFileList, VfsUtil.findFileByIoFile(file, true));
}
}
return VfsUtil.toVirtualFileArray(virtualFileList);
}
示例5: 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;
}
示例6: 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);
}
}
示例7: performPaste
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public void performPaste(@NotNull DataContext dataContext) {
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
final IdeView ideView = LangDataKeys.IDE_VIEW.getData(dataContext);
if (project == null || ideView == null) return;
final Transferable contents = CopyPasteManager.getInstance().getContents();
if (contents == null) return;
final List<File> fileList = FileCopyPasteUtil.getFileList(contents);
if (fileList == null) return;
final List<PsiElement> elements = new ArrayList<PsiElement>();
for (File file : fileList) {
final VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
if (vFile != null) {
final PsiManager instance = PsiManager.getInstance(project);
PsiFileSystemItem item = vFile.isDirectory() ? instance.findDirectory(vFile) : instance.findFile(vFile);
if (item != null) {
elements.add(item);
}
}
}
if (elements.size() > 0) {
final PsiDirectory dir = ideView.getOrChooseDirectory();
if (dir != null) {
final boolean move = LinuxDragAndDropSupport.isMoveOperation(contents);
if (move) {
new MoveFilesOrDirectoriesHandler().doMove(PsiUtilCore.toPsiElementArray(elements), dir);
}
else {
new CopyFilesOrDirectoriesHandler().doCopy(PsiUtilCore.toPsiElementArray(elements), dir);
}
}
}
}
示例8: importData
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public boolean importData(final TransferSupport support) {
if (canImport(support)) {
List<VirtualFile> pomFiles = new ArrayList<VirtualFile>();
final List<File> fileList = FileCopyPasteUtil.getFileList(support.getTransferable());
if (fileList == null) return false;
MavenProjectsManager manager = MavenProjectsManager.getInstance(myProject);
for (File file : fileList) {
VirtualFile virtualFile = VfsUtil.findFileByIoFile(file, true);
if (file.isFile()
&& virtualFile != null
&& MavenActionUtil.isMavenProjectFile(virtualFile)
&& !manager.isManagedFile(virtualFile)) {
pomFiles.add(virtualFile);
}
}
if (pomFiles.isEmpty()) {
return false;
}
manager.addManagedFiles(pomFiles);
return true;
}
return false;
}
示例9: handleDrop
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public void handleDrop(@Nonnull final Transferable t, @Nullable final Project project, EditorWindow editorWindow) {
if (project != null) {
final List<File> fileList = FileCopyPasteUtil.getFileList(t);
if (fileList != null) {
boolean dropResult = ContainerUtil.process(Extensions.getExtensions(CustomFileDropHandler.CUSTOM_DROP_HANDLER_EP, project),
handler -> !(handler.canHandle(t, myEditor) && handler.handleDrop(t, myEditor, project)));
if (!dropResult) return;
openFiles(project, fileList, editorWindow);
}
}
}
示例10: performPaste
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public void performPaste(@Nonnull DataContext dataContext) {
final Project project = dataContext.getData(CommonDataKeys.PROJECT);
final IdeView ideView = dataContext.getData(LangDataKeys.IDE_VIEW);
if (project == null || ideView == null) return;
if (!FileCopyPasteUtil.isFileListFlavorAvailable()) return;
final Transferable contents = CopyPasteManager.getInstance().getContents();
if (contents == null) return;
final List<File> fileList = FileCopyPasteUtil.getFileList(contents);
if (fileList == null) return;
final List<PsiElement> elements = new ArrayList<PsiElement>();
for (File file : fileList) {
final VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
if (vFile != null) {
final PsiManager instance = PsiManager.getInstance(project);
PsiFileSystemItem item = vFile.isDirectory() ? instance.findDirectory(vFile) : instance.findFile(vFile);
if (item != null) {
elements.add(item);
}
}
}
if (elements.size() > 0) {
final PsiDirectory dir = ideView.getOrChooseDirectory();
if (dir != null) {
final boolean move = LinuxDragAndDropSupport.isMoveOperation(contents);
if (move) {
new MoveFilesOrDirectoriesHandler().doMove(PsiUtilCore.toPsiElementArray(elements), dir);
}
else {
new CopyFilesOrDirectoriesHandler().doCopy(PsiUtilCore.toPsiElementArray(elements), dir);
}
}
}
}
示例11: canHandle
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public boolean canHandle(@Nonnull Transferable t, Editor editor) {
List<File> list = FileCopyPasteUtil.getFileList(t);
if (list == null || list.size() != 1) return false;
return PatchFileType.isPatchFile(list.get(0));
}
示例12: handleDrop
import com.intellij.ide.dnd.FileCopyPasteUtil; //导入方法依赖的package包/类
@Override
public boolean handleDrop(@Nonnull Transferable t, Editor editor, @Nonnull final Project project) {
List<File> list = FileCopyPasteUtil.getFileList(t);
if (list == null || list.size() != 1) return false;
return ApplyPatchAction.showAndGetApplyPatch(project, list.get(0));
}