PackageDependenciesNode (PsiDirectory dir) { final VirtualFile vFile = dir.getVirtualFile(); if (myMarker == null) return null; final boolean[] isMarked = new boolean[]{myMarker.isMarked(vFile)}; 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 { while (rootToReload == null && dirToReload != null) { dirToReload = dirToReload.getParent(); rootToReload = myModuleDirNodes.get(dirToReload); } } myFileIndex.iterateContentUnderDirectory(vFile, new MyContentIterator() { @Override public boolean processFile(@NotNull VirtualFile fileOrDir) { isMarked[0] |= myMarker.isMarked(fileOrDir); return super.processFile(fileOrDir); } }); if (!isMarked[0]) return null; getModuleDirNode(vFile, myFileIndex.getModuleForFile(vFile), null); return rootToReload != null ? rootToReload : myRoot; }