avoid calling VirtualFile.getChildren() when processing beforeDeletion events. Use getInDbChildren() instead

This commit is contained in:
Eugene Zhuravlev
2009-09-25 19:18:09 +04:00
parent 3c3d03e665
commit 563a156e04
@@ -34,6 +34,7 @@ import com.intellij.openapi.vfs.*;
import com.intellij.openapi.vfs.ex.VirtualFileManagerEx;
import com.intellij.openapi.vfs.newvfs.ManagingFS;
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import com.intellij.openapi.vfs.newvfs.impl.NullVirtualFile;
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
@@ -1320,8 +1321,11 @@ public class FileBasedIndex implements ApplicationComponent {
}
if (file.isDirectory()) {
if (isMock(file) || myManagingFS.wereChildrenAccessed(file)) {
for (VirtualFile child : file.getChildren()) {
invalidateIndices(child, markForReindex);
final Collection<VirtualFile> children = (file instanceof NewVirtualFile)? ((NewVirtualFile)file).getInDbChildren() : Arrays.asList(file.getChildren());
for (VirtualFile child : children) {
if (NullVirtualFile.INSTANCE != child) {
invalidateIndices(child, markForReindex);
}
}
}
}