boolean (@NotNull final Project project, @NotNull final PsiElement context) { PsiJavaDocumentedElement container = getContainer(context); boolean isValid = container != null && !(container instanceof PsiMethod && container instanceof SyntheticElement); if (!isValid) { return false; } if (container instanceof PsiJavaModule) { setText(JavaAnalysisBundle.message("suppress.inspection.module")); } else if (container instanceof PsiClass) { setText(JavaAnalysisBundle.message("suppress.inspection.class")); } else if (container instanceof PsiMethod) { setText(JavaAnalysisBundle.message("suppress.inspection.method")); } else { setText(JavaAnalysisBundle.message("suppress.inspection.field")); } return true; }