use of com.intellij.codeInspection.javaDoc.JavaDocLocalInspection in project intellij-community by JetBrains.
the class JavaDocCommentFixer method getDocLocalInspection.
@NotNull
private static JavaDocLocalInspection getDocLocalInspection() {
JavaDocLocalInspection localInspection = new JavaDocLocalInspection();
//region visibility
localInspection.TOP_LEVEL_CLASS_OPTIONS.ACCESS_JAVADOC_REQUIRED_FOR = PsiModifier.PRIVATE;
localInspection.INNER_CLASS_OPTIONS.ACCESS_JAVADOC_REQUIRED_FOR = PsiModifier.PRIVATE;
localInspection.FIELD_OPTIONS.ACCESS_JAVADOC_REQUIRED_FOR = PsiModifier.PRIVATE;
localInspection.METHOD_OPTIONS.ACCESS_JAVADOC_REQUIRED_FOR = PsiModifier.PRIVATE;
//endregion
localInspection.setIgnoreEmptyDescriptions(true);
//region class type arguments
if (!localInspection.TOP_LEVEL_CLASS_OPTIONS.REQUIRED_TAGS.contains(PARAM_TAG)) {
localInspection.TOP_LEVEL_CLASS_OPTIONS.REQUIRED_TAGS += PARAM_TAG;
}
if (!localInspection.INNER_CLASS_OPTIONS.REQUIRED_TAGS.contains(PARAM_TAG)) {
localInspection.INNER_CLASS_OPTIONS.REQUIRED_TAGS += PARAM_TAG;
}
return localInspection;
}
use of com.intellij.codeInspection.javaDoc.JavaDocLocalInspection in project intellij-community by JetBrains.
the class JavaDocCommentFixer method fixComment.
@Override
public void fixComment(@NotNull Project project, @NotNull Editor editor, @NotNull PsiComment comment) {
if (!(comment instanceof PsiDocComment)) {
return;
}
PsiDocComment docComment = (PsiDocComment) comment;
PsiJavaDocumentedElement owner = docComment.getOwner();
if (owner == null) {
return;
}
PsiFile file = comment.getContainingFile();
if (file == null) {
return;
}
JavaDocReferenceInspection referenceInspection = new JavaDocReferenceInspection();
JavaDocLocalInspection localInspection = getDocLocalInspection();
InspectionManager inspectionManager = InspectionManager.getInstance(project);
ProblemDescriptor[] referenceProblems = null;
ProblemDescriptor[] otherProblems = null;
if (owner instanceof PsiClass) {
referenceProblems = referenceInspection.checkClass(((PsiClass) owner), inspectionManager, false);
otherProblems = localInspection.checkClass(((PsiClass) owner), inspectionManager, false);
} else if (owner instanceof PsiField) {
referenceProblems = referenceInspection.checkField(((PsiField) owner), inspectionManager, false);
otherProblems = localInspection.checkField(((PsiField) owner), inspectionManager, false);
} else if (owner instanceof PsiMethod) {
referenceProblems = referenceInspection.checkMethod((PsiMethod) owner, inspectionManager, false);
otherProblems = localInspection.checkMethod((PsiMethod) owner, inspectionManager, false);
}
if (referenceProblems != null) {
fixReferenceProblems(referenceProblems, project);
}
if (otherProblems != null) {
fixCommonProblems(otherProblems, comment, editor.getDocument(), project);
}
PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument());
ensureContentOrdered(docComment, editor.getDocument());
locateCaret(docComment, editor, file);
}
use of com.intellij.codeInspection.javaDoc.JavaDocLocalInspection in project intellij-community by JetBrains.
the class LightAdvHighlightingTest method testJavadoc.
public void testJavadoc() {
enableInspectionTool(new JavaDocLocalInspection());
doTest(true);
}
use of com.intellij.codeInspection.javaDoc.JavaDocLocalInspection in project intellij-community by JetBrains.
the class JavadocHighlightingTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.HIGHEST);
myInspection = new JavaDocLocalInspection();
myInspection.setIgnoreDuplicatedThrows(false);
enableInspectionTools(myInspection, new JavaDocReferenceInspection());
}
use of com.intellij.codeInspection.javaDoc.JavaDocLocalInspection in project intellij-community by JetBrains.
the class JavaDocInspectionTest method testPackageInfo.
public void testPackageInfo() {
JavaDocLocalInspection inspection = new JavaDocLocalInspection();
inspection.IGNORE_DEPRECATED = true;
inspection.setPackageOption("public", "@author");
myFixture.testInspection("packageInfo", new LocalInspectionToolWrapper(inspection));
}
Aggregations