PackageDependenciesNode (final PsiFile file) { final VirtualFile vFile = file.getVirtualFile(); LOG.assertTrue(vFile != null); boolean isMarked = myMarker != null && myMarker.isMarked(vFile); if (!isMarked) return null; VirtualFile dirToReload = vFile.getParent(); PackageDependenciesNode rootToReload = myModuleDirNodes.get(dirToReload); if (rootToReload == null && myFlattenPackages) { final Module module = myFileIndex.getModuleForFile(vFile); final boolean moduleNodeExist = myModuleNodes.get(module) != null; rootToReload = getModuleNode(module); if (!moduleNodeExist) { rootToReload = null; //need to reload from parent / mostly for problems view } } else { //reload parents of compacted nodes as getFileParentNode() may expand them while ((rootToReload == null || ((DirectoryNode)rootToReload).getCompactedDirNode() != null) && dirToReload != null){ dirToReload = dirToReload.getParent(); rootToReload = myModuleDirNodes.get(dirToReload); } } PackageDependenciesNode dirNode = getFileParentNode(vFile); if (findNodeForPsiElement(dirNode, file) == null) { //check if dir node already contains child dirNode.add(new FileNode(vFile, myProject, true)); } return rootToReload; }