List<DomEvent> (final VirtualFile file) { if (!(file instanceof NewVirtualFile) || myProject.isDisposed()) { return Collections.emptyList(); } FileManager fileManager = PsiManagerEx.getInstanceEx(myProject).getFileManager(); final List<DomEvent> events = new ArrayList<>(); VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor<Void>() { @Override public boolean visitFile(@NotNull VirtualFile file) { if (!file.isDirectory() && FileTypeRegistry.getInstance().isFileOfType(file, XmlFileType.INSTANCE)) { PsiFile psiFile = fileManager.getCachedPsiFile(file); DomFileElementImpl<?> domElement = psiFile instanceof XmlFile ? getCachedFileElement((XmlFile)psiFile) : null; if (domElement != null) { events.add(new DomEvent(domElement, false)); } } return true; } @Override public Iterable<VirtualFile> getChildrenIterable(@NotNull VirtualFile file) { return ((NewVirtualFile)file).getCachedChildren(); } }); return events; }