PackageDependenciesNode (PsiFileSystemItem file, final PsiElement psiElement) { if (file instanceof PsiDirectory) { return getModuleDirNode(file.getVirtualFile(), myFileIndex.getModuleForFile(file.getVirtualFile()), null); } PackageDependenciesNode parent = getFileParentNode(file.getVirtualFile()); PackageDependenciesNode[] nodes = findNodeForPsiElement(parent, file); if (nodes == null || nodes.length == 0) { return null; } else { for (PackageDependenciesNode node : nodes) { if (node.getPsiElement() == psiElement) return node; } return nodes[0]; } }