PsiPackage (@NotNull PsiElement element) { PsiFile file = element.getContainingFile(); PsiDirectory directory = file == null ? null : file.getContainingDirectory(); return directory == null ? null : JavaDirectoryService.getInstance().getPackage(directory); }