Search in sources :

Example 1 with StructureAnnotationDeclarationValidationResult

use of org.qi4j.ide.plugin.idea.injections.structure.common.Qi4jStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult in project qi4j-sdk by Qi4j.

the class StructureAnnotationDeclaredCorrectlyInspection method verifyAnnotationDeclaredCorrectly.

@Nullable
protected final ProblemDescriptor[] verifyAnnotationDeclaredCorrectly(@NotNull PsiVariable psiVariable, @NotNull PsiAnnotation structureAnnotation, @NotNull InspectionManager manager) {
    StructureAnnotationDeclarationValidationResult annotationCheck = validateStructureAnnotationDeclaration(psiVariable);
    switch(annotationCheck) {
        case invalidInjectionType:
            String message = message("injections.structure.annotation.declared.correctly.error.invalid.injection.type", psiVariable.getType().getCanonicalText());
            AbstractFix removeStructureAnnotationFix = createRemoveAnnotationFix(structureAnnotation);
            ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(structureAnnotation, message, removeStructureAnnotationFix, GENERIC_ERROR_OR_WARNING);
            return new ProblemDescriptor[] { problemDescriptor };
    }
    return null;
}
Also used : StructureAnnotationDeclarationValidationResult(org.qi4j.ide.plugin.idea.injections.structure.common.Qi4jStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult) ProblemDescriptor(com.intellij.codeInspection.ProblemDescriptor) AbstractFix(org.qi4j.ide.plugin.idea.common.inspections.AbstractFix) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ProblemDescriptor (com.intellij.codeInspection.ProblemDescriptor)1 Nullable (org.jetbrains.annotations.Nullable)1 AbstractFix (org.qi4j.ide.plugin.idea.common.inspections.AbstractFix)1 StructureAnnotationDeclarationValidationResult (org.qi4j.ide.plugin.idea.injections.structure.common.Qi4jStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult)1