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));
}
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));
}
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));
}
use of com.intellij.lang.annotation.Annotation in project intellij-plugins by JetBrains.
the class JstdConfigFileAnnotator method annotateDocument.
private static void annotateDocument(@NotNull YAMLDocument yamlDocument, @NotNull final AnnotationHolder holder) {
final YAMLValue value = yamlDocument.getTopLevelValue();
if (!(value instanceof YAMLMapping)) {
holder.createErrorAnnotation(yamlDocument, "Expected mapping");
return;
}
final Collection<YAMLKeyValue> keyValues = ((YAMLMapping) value).getKeyValues();
markStrangeSymbols(yamlDocument, holder);
BasePathInfo basePathInfo = new BasePathInfo(yamlDocument);
annotateBasePath(basePathInfo, holder);
final Set<String> visitedKeys = Sets.newHashSet();
for (YAMLKeyValue keyValue : keyValues) {
String keyText = keyValue.getKeyText();
if (keyValue.getKey() == null) {
holder.createErrorAnnotation(keyValue.getFirstChild(), "Expected key");
continue;
}
if (!JstdConfigFileUtils.isTopLevelKey(keyValue)) {
holder.createErrorAnnotation(keyValue.getKey(), "Unexpected key '" + keyText + "'");
} else if (!visitedKeys.add(keyText)) {
holder.createErrorAnnotation(keyValue.getKey(), "Duplicated '" + keyText + "' key");
} else if (JstdConfigFileUtils.isTopLevelKeyWithInnerFileSequence(keyValue)) {
annotateKeyValueWithInnerFileSequence(keyValue, holder, basePathInfo.getBasePath());
}
}
if (!visitedKeys.contains("test")) {
Annotation annotation = holder.createWeakWarningAnnotation(yamlDocument, "JsTestDriver configuration file should have 'test:' section");
annotation.registerFix(new AddTestSectionAction());
}
}
use of com.intellij.lang.annotation.Annotation in project intellij-plugins by JetBrains.
the class ActionScriptConstructorChecker method checkMissedConstructor.
public void checkMissedConstructor(@NotNull JSClass jsClass) {
if (jsClass.isInterface())
return;
final JSFunction nontrivialSuperClassConstructor = getNontrivialSuperClassConstructor(jsClass);
if (nontrivialSuperClassConstructor == null) {
return;
}
final PsiElement place = getPlaceForNamedElementProblem(jsClass);
Annotation annotation = myProblemReporter.registerGenericError(place, JSBundle.message("javascript.validation.message.missed.super.constructor.call"));
annotation.registerFix(JSFixFactory.getInstance().addConstructorAndSuperInvocationFix(jsClass, nontrivialSuperClassConstructor));
}
Aggregations