inferred annotations in gutter

This commit is contained in:
Ilya Klyuchnikov
2014-07-10 10:35:28 +02:00
committed by peter
parent 8c5790524b
commit 073012d86e
2 changed files with 19 additions and 4 deletions
@@ -55,7 +55,11 @@ public class ExternalAnnotationsLineMarkerProvider implements LineMarkerProvider
final PsiModifierListOwner modifierListOwner = (PsiModifierListOwner)element;
final ExternalAnnotationsManager annotationsManager = ExternalAnnotationsManager.getInstance(modifierListOwner.getProject());
PsiAnnotation[] externalAnnotations = annotationsManager.findExternalAnnotations(modifierListOwner);
if (externalAnnotations != null && externalAnnotations.length > 0) {
final InferredAnnotationsManager inferredAnnotationsManager = InferredAnnotationsManager.getInstance(modifierListOwner.getProject());
PsiAnnotation[] inferredAnnotations = inferredAnnotationsManager.findInferredAnnotations(modifierListOwner);
if (externalAnnotations != null && externalAnnotations.length > 0 ||
inferredAnnotations != null && inferredAnnotations.length > 0) {
owner = (PsiModifierListOwner)element;
} else if (element instanceof PsiMethod) {
final PsiParameter[] parameters = ((PsiMethod)element).getParameterList().getParameters();
@@ -65,6 +69,11 @@ public class ExternalAnnotationsLineMarkerProvider implements LineMarkerProvider
owner = (PsiMethod)element;
break;
}
inferredAnnotations = inferredAnnotationsManager.findInferredAnnotations(parameter);
if (inferredAnnotations != null && inferredAnnotations.length > 0) {
owner = (PsiMethod)element;
break;
}
}
}
}
@@ -18,6 +18,7 @@ package com.intellij.codeInsight.javadoc;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.ExternalAnnotationsManager;
import com.intellij.codeInsight.InferredAnnotationsManager;
import com.intellij.codeInsight.documentation.DocumentationManagerUtil;
import com.intellij.lang.ASTNode;
import com.intellij.lang.LangBundle;
@@ -699,10 +700,15 @@ public class JavaDocInfoGenerator {
final PsiModifierList ownerModifierList = owner.getModifierList();
if (ownerModifierList == null) return;
generateAnnotations(buffer, owner, ownerModifierList.getAnnotations(), false, generateLink);
final PsiAnnotation[] externalAnnotations = ExternalAnnotationsManager.getInstance(owner.getProject()).findExternalAnnotations(owner);
if (externalAnnotations != null) {
generateAnnotations(buffer, owner, externalAnnotations, true, generateLink);
PsiAnnotation[] externalAnnotations = ExternalAnnotationsManager.getInstance(owner.getProject()).findExternalAnnotations(owner);
if (externalAnnotations == null) {
externalAnnotations = new PsiAnnotation[]{};
}
PsiAnnotation[] inferredAnnotations = InferredAnnotationsManager.getInstance(owner.getProject()).findInferredAnnotations(owner);
if (inferredAnnotations != null) {
externalAnnotations = ArrayUtil.mergeArrays(externalAnnotations, inferredAnnotations, PsiAnnotation.ARRAY_FACTORY);
}
generateAnnotations(buffer, owner, externalAnnotations, true, generateLink);
}
private static void generateAnnotations(StringBuilder buffer,