PsiAnnotationMethod (PsiFile file, int offset) { PsiNameValuePair pair = ParameterInfoUtils.findParentOfType(file, offset, PsiNameValuePair.class); if (pair == null) return null; final PsiReference reference = pair.getReference(); final PsiElement resolved = reference != null ? reference.resolve():null; return PsiUtil.isAnnotationMethod(resolved) ? (PsiAnnotationMethod)resolved : null; }