PsiDirectory (PsiElement element) { final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element); final VirtualFile sourceRoot = ProjectRootManager.getInstance(myProject).getFileIndex().getSourceRootForFile(virtualFile); return myPsiManager.findDirectory(sourceRoot); }