PsiElement (@NotNull DataContext dataContext) { Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) return null; PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext); if (element instanceof PsiField) return element; return PsiTreeUtil.getParentOfType(element, PsiMethod.class, false); }