use of org.eclipse.xtext.common.types.JvmAnnotationTarget in project xtext-xtend by eclipse.
the class XtendValidator method checkDeprecated.
@Override
public void checkDeprecated(XImportDeclaration decl) {
XtendFile file = EcoreUtil2.getContainerOfType(decl, XtendFile.class);
if (file != null) {
for (XtendTypeDeclaration t : file.getXtendTypes()) {
for (EObject e : jvmModelAssociations.getJvmElements(t)) {
if (e instanceof JvmAnnotationTarget) {
if (DeprecationUtil.isDeprecated((JvmAnnotationTarget) e)) {
return;
}
}
}
if (hasAnnotation(t, Deprecated.class)) {
return;
}
}
}
super.checkDeprecated(decl);
}
use of org.eclipse.xtext.common.types.JvmAnnotationTarget in project xtext-xtend by eclipse.
the class XtendHighlightingCalculator method highlightAnnotation.
@Override
protected void highlightAnnotation(XAnnotation annotation, IHighlightedPositionAcceptor acceptor) {
JvmType annotationType = annotation.getAnnotationType();
if (annotationType instanceof JvmAnnotationTarget) {
for (JvmAnnotationReference annotationReference : ((JvmAnnotationTarget) annotationType).getAnnotations()) {
JvmAnnotationType otherAnnotation = annotationReference.getAnnotation();
if (otherAnnotation != null && !otherAnnotation.eIsProxy() && Active.class.getName().equals(otherAnnotation.getIdentifier())) {
highlightAnnotation(annotation, acceptor, ACTIVE_ANNOTATION);
return;
}
}
}
super.highlightAnnotation(annotation, acceptor);
}
use of org.eclipse.xtext.common.types.JvmAnnotationTarget in project xtext-xtend by eclipse.
the class XtendHoverDocumentationProviderTest method bug380551_TestLinkToNativeJavaType.
@Test
public void bug380551_TestLinkToNativeJavaType() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package testpackage");
_builder.newLine();
_builder.append("import javax.annotation.Resource");
_builder.newLine();
_builder.append("@Resource");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile xtendFile = this.parseHelper.parse(_builder, this.getResourceSet());
final XtendClass clazz = IterableExtensions.<XtendClass>head(Iterables.<XtendClass>filter(xtendFile.getXtendTypes(), XtendClass.class));
JvmGenericType _inferredType = this.jvmModelAssociations.getInferredType(clazz);
final JvmAnnotationTarget target = ((JvmAnnotationTarget) _inferredType);
Assert.assertNotNull(this.hoverProvider.getHoverInfo(IterableExtensions.<JvmAnnotationReference>head(target.getAnnotations()).getAnnotation()));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations