Search in sources :

Example 61 with Annotation

use of com.intellij.lang.annotation.Annotation in project android by JetBrains.

the class AndroidColorAnnotatorTest method testColorReferenceInXml1.

public void testColorReferenceInXml1() {
    // Reference to a color from a layout file
    Annotation annotation = findAnnotation("res/layout/color_test.xml", "@color/color1", XmlAttributeValue.class);
    checkAnnotationColor(annotation, new Color(63, 81, 181));
}
Also used : Annotation(com.intellij.lang.annotation.Annotation)

Example 62 with Annotation

use of com.intellij.lang.annotation.Annotation in project android by JetBrains.

the class AndroidColorAnnotatorTest method testColorInValues1.

public void testColorInValues1() {
    // Color definition in a values file
    Annotation annotation = findAnnotation("res/values/colors1.xml", "3F51B5", XmlTag.class);
    checkAnnotationColor(annotation, new Color(63, 81, 181));
}
Also used : Annotation(com.intellij.lang.annotation.Annotation)

Example 63 with Annotation

use of com.intellij.lang.annotation.Annotation in project android by JetBrains.

the class AndroidColorAnnotatorTest method testColorStateListInValues.

public void testColorStateListInValues() {
    // Color definition in a color state list file
    Annotation annotation = findAnnotation("res/color/selector.xml", "ffff0000", XmlAttributeValue.class);
    checkAnnotationColor(annotation, new Color(255, 0, 0));
    annotation = findAnnotation("res/color/selector.xml", "#ff00ff00", XmlAttributeValue.class);
    checkAnnotationColor(annotation, new Color(0, 255, 0));
}
Also used : XmlAttributeValue(com.intellij.psi.xml.XmlAttributeValue) Annotation(com.intellij.lang.annotation.Annotation)

Example 64 with Annotation

use of com.intellij.lang.annotation.Annotation in project android by JetBrains.

the class AndroidColorAnnotatorTest method testColorReferenceInXml2.

public void testColorReferenceInXml2() {
    // Reference to a color from a layout file
    Annotation annotation = findAnnotation("res/layout/color_test.xml", "@color/color2", XmlAttributeValue.class);
    checkAnnotationColor(annotation, new Color(0x303F9F));
}
Also used : Annotation(com.intellij.lang.annotation.Annotation)

Example 65 with Annotation

use of com.intellij.lang.annotation.Annotation in project intellij-community by JetBrains.

the class JavaDocAnnotator method annotate.

@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
    if (element instanceof PsiDocTag) {
        String name = ((PsiDocTag) element).getName();
        if ("param".equals(name)) {
            PsiDocTagValue tagValue = ((PsiDocTag) element).getValueElement();
            if (tagValue != null) {
                Annotation annotation = holder.createInfoAnnotation(tagValue, null);
                annotation.setTextAttributes(JavaHighlightingColors.DOC_COMMENT_TAG_VALUE);
            }
        }
    }
}
Also used : PsiDocTag(com.intellij.psi.javadoc.PsiDocTag) PsiDocTagValue(com.intellij.psi.javadoc.PsiDocTagValue) Annotation(com.intellij.lang.annotation.Annotation)

Aggregations

Annotation (com.intellij.lang.annotation.Annotation)98 PsiElement (com.intellij.psi.PsiElement)24 ASTNode (com.intellij.lang.ASTNode)22 TextRange (com.intellij.openapi.util.TextRange)19 IntentionAction (com.intellij.codeInsight.intention.IntentionAction)15 Project (com.intellij.openapi.project.Project)11 NotNull (org.jetbrains.annotations.NotNull)10 PsiFile (com.intellij.psi.PsiFile)8 GrModifierFix (org.jetbrains.plugins.groovy.codeInspection.bugs.GrModifierFix)6 HighlightDisplayLevel (com.intellij.codeHighlighting.HighlightDisplayLevel)4 HighlightSeverity (com.intellij.lang.annotation.HighlightSeverity)4 Editor (com.intellij.openapi.editor.Editor)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 GrModifierList (org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList)4 HighlightDisplayKey (com.intellij.codeInsight.daemon.HighlightDisplayKey)3 Module (com.intellij.openapi.module.Module)3 PsiReference (com.intellij.psi.PsiReference)3 IElementType (com.intellij.psi.tree.IElementType)3 IncorrectOperationException (com.intellij.util.IncorrectOperationException)3 Nullable (org.jetbrains.annotations.Nullable)3