use of org.jetbrains.idea.devkit.inspections.quickfix.CreateHtmlDescriptionFix in project intellij-community by JetBrains.
the class InspectionDescriptionNotFoundInspection method checkClass.
@Override
public ProblemDescriptor[] checkClass(@NotNull PsiClass psiClass, @NotNull InspectionManager manager, boolean isOnTheFly) {
final Project project = psiClass.getProject();
final PsiIdentifier nameIdentifier = psiClass.getNameIdentifier();
final Module module = ModuleUtilCore.findModuleForPsiElement(psiClass);
if (nameIdentifier == null || module == null || !PsiUtil.isInstantiable(psiClass))
return null;
final PsiClass base = JavaPsiFacade.getInstance(project).findClass(INSPECTION_PROFILE_ENTRY, psiClass.getResolveScope());
if (base == null || !psiClass.isInheritor(base, true) || isPathMethodsAreOverridden(psiClass))
return null;
final InspectionDescriptionInfo info = InspectionDescriptionInfo.create(module, psiClass);
if (!info.isValid() || info.hasDescriptionFile())
return null;
final PsiElement problemElement = getProblemElement(psiClass, info.getShortNameMethod());
final ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(problemElement == null ? nameIdentifier : problemElement, "Inspection does not have a description", isOnTheFly, new LocalQuickFix[] { new CreateHtmlDescriptionFix(info.getFilename(), module, DescriptionType.INSPECTION) }, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
return new ProblemDescriptor[] { problemDescriptor };
}
Aggregations