List<PsiFile> (@NotNull Project project) { List<PsiFile> currentFiles = new ArrayList<>(); for (VirtualFile file : myVirtualFiles) { if (!file.isValid()) continue; PsiFile psiFile = PsiManager.getInstance(project).findFile(file); if (psiFile != null) { PsiElement navigationElement = psiFile.getNavigationElement(); // Sources may be downloaded. if (navigationElement instanceof PsiFile) { currentFiles.add((PsiFile)navigationElement); continue; } currentFiles.add(psiFile); } } return currentFiles; }