PsiJavaDocumentedElement (@Nullable final PsiElement contextElement) { if (!(contextElement instanceof PsiKeyword)) return null; final PsiElement element = PsiTreeUtil.skipParentsOfType(contextElement, PsiModifierList.class, PsiReferenceList.class, PsiTypeElement.class); if (!(element instanceof PsiJavaDocumentedElement)) return null; return (PsiJavaDocumentedElement)element; }