PsiFileSystemItem (@NotNull SelectInContext context) { VirtualFile virtualFile = context.getVirtualFile(); PsiFileSystemItem psiFile = PsiManager.getInstance(myProject).findFile(virtualFile); if (psiFile != null) { return psiFile; } if (context.getSelectorInFile() instanceof PsiFile) { return (PsiFile)context.getSelectorInFile(); } if (virtualFile.isDirectory()) { return PsiManager.getInstance(myProject).findDirectory(virtualFile); } return null; }