List<PsiFile> (DataContext dataContext) { Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) return Collections.emptyList(); VirtualFile[] virtualFiles = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext); if (virtualFiles == null) return Collections.emptyList(); PsiManager psiManager = PsiManager.getInstance(project); List<PsiFile> psiFiles = new ArrayList<>(virtualFiles.length); for (VirtualFile virtualFile : virtualFiles) { if (virtualFile.isDirectory()) return Collections.emptyList(); PsiFile psiFile = psiManager.findFile(virtualFile); if (psiFile == null || psiFile instanceof PsiBinaryFile) return Collections.emptyList(); psiFiles.add(psiFile); } return psiFiles; }