Search in sources :

Example 1 with XtendAnnotationReferenceImpl

use of org.eclipse.xtend.core.macro.declaration.XtendAnnotationReferenceImpl in project xtext-xtend by eclipse.

the class AnnotationReferenceBuildContextImpl method _setValue.

protected void _setValue(final JvmAnnotationAnnotationValue it, final AnnotationReference[] value, final String componentType, final boolean mustBeArray) {
    this.checkType(it, componentType, mustBeArray);
    for (final AnnotationReference annotationValue : value) {
        boolean _matched = false;
        if (annotationValue instanceof JvmAnnotationReferenceImpl) {
            _matched = true;
            it.getValues().add(EcoreUtil2.<JvmAnnotationReference>cloneWithProxies(((JvmAnnotationReferenceImpl) annotationValue).getDelegate()));
        }
        if (!_matched) {
            if (annotationValue instanceof XtendAnnotationReferenceImpl) {
                _matched = true;
                throw new IllegalArgumentException("Multiple source annotations cannot be set as values. Please the the expression not the value.");
            }
        }
    }
}
Also used : JvmAnnotationReference(org.eclipse.xtext.common.types.JvmAnnotationReference) AnnotationReference(org.eclipse.xtend.lib.macro.declaration.AnnotationReference) JvmAnnotationReferenceImpl(org.eclipse.xtend.core.macro.declaration.JvmAnnotationReferenceImpl) XtendAnnotationReferenceImpl(org.eclipse.xtend.core.macro.declaration.XtendAnnotationReferenceImpl)

Example 2 with XtendAnnotationReferenceImpl

use of org.eclipse.xtend.core.macro.declaration.XtendAnnotationReferenceImpl in project xtext-xtend by eclipse.

the class CompilationUnitImpl method toAnnotationReference.

public AnnotationReference toAnnotationReference(final XAnnotation delegate) {
    final Function1<XAnnotation, XtendAnnotationReferenceImpl> _function = (XAnnotation it) -> {
        XtendAnnotationReferenceImpl _xtendAnnotationReferenceImpl = new XtendAnnotationReferenceImpl();
        final Procedure1<XtendAnnotationReferenceImpl> _function_1 = (XtendAnnotationReferenceImpl it_1) -> {
            it_1.setDelegate(delegate);
            it_1.setCompilationUnit(this);
        };
        return ObjectExtensions.<XtendAnnotationReferenceImpl>operator_doubleArrow(_xtendAnnotationReferenceImpl, _function_1);
    };
    return this.<XAnnotation, XtendAnnotationReferenceImpl>getOrCreate(delegate, _function);
}
Also used : Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) XAnnotation(org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation) XtendAnnotationReferenceImpl(org.eclipse.xtend.core.macro.declaration.XtendAnnotationReferenceImpl)

Example 3 with XtendAnnotationReferenceImpl

use of org.eclipse.xtend.core.macro.declaration.XtendAnnotationReferenceImpl in project xtext-xtend by eclipse.

the class TracabilityImpl method isSource.

@Override
public boolean isSource(final Element element) {
    boolean _switchResult = false;
    boolean _matched = false;
    if (element instanceof XtendNamedElementImpl) {
        _matched = true;
        _switchResult = true;
    }
    if (!_matched) {
        if (element instanceof XtendAnnotationReferenceImpl) {
            _matched = true;
            _switchResult = true;
        }
    }
    if (!_matched) {
        if (element instanceof Expression) {
            _matched = true;
            _switchResult = true;
        }
    }
    if (!_matched) {
        if (element instanceof TypeReferenceImpl) {
            JvmTypeReference _source = ((TypeReferenceImpl) element).getSource();
            boolean _tripleNotEquals = (_source != null);
            if (_tripleNotEquals) {
                _matched = true;
                _switchResult = true;
            }
        }
    }
    if (!_matched) {
        _switchResult = false;
    }
    return _switchResult;
}
Also used : Expression(org.eclipse.xtend.lib.macro.expression.Expression) TypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) XtendNamedElementImpl(org.eclipse.xtend.core.macro.declaration.XtendNamedElementImpl) XtendAnnotationReferenceImpl(org.eclipse.xtend.core.macro.declaration.XtendAnnotationReferenceImpl)

Aggregations

XtendAnnotationReferenceImpl (org.eclipse.xtend.core.macro.declaration.XtendAnnotationReferenceImpl)3 JvmAnnotationReferenceImpl (org.eclipse.xtend.core.macro.declaration.JvmAnnotationReferenceImpl)1 TypeReferenceImpl (org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl)1 XtendNamedElementImpl (org.eclipse.xtend.core.macro.declaration.XtendNamedElementImpl)1 AnnotationReference (org.eclipse.xtend.lib.macro.declaration.AnnotationReference)1 Expression (org.eclipse.xtend.lib.macro.expression.Expression)1 JvmAnnotationReference (org.eclipse.xtext.common.types.JvmAnnotationReference)1 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)1 XAnnotation (org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation)1 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)1