Java 类org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotationsPackage 实例源码

项目:xtext-extras    文件:XbaseWithAnnotationsBatchScopeProvider.java   
@Override
public IScope getScope(EObject context, EReference reference) {
    if (reference == XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT) {
        XAnnotation annotation = EcoreUtil2.getContainerOfType(context, XAnnotation.class);
        JvmType annotationType = annotation.getAnnotationType();
        if (annotationType == null || annotationType.eIsProxy() || !(annotationType instanceof JvmAnnotationType)) {
            return IScope.NULLSCOPE;
        }
        Iterable<JvmOperation> operations = ((JvmAnnotationType) annotationType).getDeclaredOperations();
        Iterable<IEObjectDescription> descriptions = transform(operations, new Function<JvmOperation, IEObjectDescription>() {
            @Override
            public IEObjectDescription apply(JvmOperation from) {
                return EObjectDescription.create(QualifiedName.create(from.getSimpleName()), from);
            }
        });
        return MapBasedScope.createScope(IScope.NULLSCOPE, descriptions);
    }
    return super.getScope(context, reference);
}
项目:xtext-extras    文件:XAnnotationImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setValue(XExpression newValue)
{
    if (newValue != value)
    {
        NotificationChain msgs = null;
        if (value != null)
            msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XAnnotationsPackage.XANNOTATION__VALUE, null, msgs);
        if (newValue != null)
            msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XAnnotationsPackage.XANNOTATION__VALUE, null, msgs);
        msgs = basicSetValue(newValue, msgs);
        if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, XAnnotationsPackage.XANNOTATION__VALUE, newValue, newValue));
}
项目:xtext-extras    文件:XAnnotationImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
    switch (featureID)
    {
        case XAnnotationsPackage.XANNOTATION__ELEMENT_VALUE_PAIRS:
            return getElementValuePairs();
        case XAnnotationsPackage.XANNOTATION__ANNOTATION_TYPE:
            if (resolve) return getAnnotationType();
            return basicGetAnnotationType();
        case XAnnotationsPackage.XANNOTATION__VALUE:
            return getValue();
    }
    return super.eGet(featureID, resolve, coreType);
}
项目:xtext-extras    文件:XAnnotationImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
    switch (featureID)
    {
        case XAnnotationsPackage.XANNOTATION__ELEMENT_VALUE_PAIRS:
            getElementValuePairs().clear();
            getElementValuePairs().addAll((Collection<? extends XAnnotationElementValuePair>)newValue);
            return;
        case XAnnotationsPackage.XANNOTATION__ANNOTATION_TYPE:
            setAnnotationType((JvmType)newValue);
            return;
        case XAnnotationsPackage.XANNOTATION__VALUE:
            setValue((XExpression)newValue);
            return;
    }
    super.eSet(featureID, newValue);
}
项目:xtext-extras    文件:XAnnotationImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
    switch (featureID)
    {
        case XAnnotationsPackage.XANNOTATION__ELEMENT_VALUE_PAIRS:
            getElementValuePairs().clear();
            return;
        case XAnnotationsPackage.XANNOTATION__ANNOTATION_TYPE:
            setAnnotationType((JvmType)null);
            return;
        case XAnnotationsPackage.XANNOTATION__VALUE:
            setValue((XExpression)null);
            return;
    }
    super.eUnset(featureID);
}
项目:xtext-extras    文件:XAnnotationElementValuePairImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setValue(XExpression newValue)
{
    if (newValue != value)
    {
        NotificationChain msgs = null;
        if (value != null)
            msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE, null, msgs);
        if (newValue != null)
            msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE, null, msgs);
        msgs = basicSetValue(newValue, msgs);
        if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE, newValue, newValue));
}
项目:xtext-extras    文件:UnresolvedFeatureCallTypeAwareMessageProvider.java   
/**
 * @Nullable
 */
protected String getTypeName(final EClass c, final EStructuralFeature referingFeature) {
  if ((referingFeature == XAnnotationsPackage.Literals.XANNOTATION__ANNOTATION_TYPE)) {
    return " to an annotation type";
  }
  if ((c == TypesPackage.Literals.JVM_ENUMERATION_TYPE)) {
    return " to an enum type";
  }
  boolean _isAssignableFrom = EcoreUtil2.isAssignableFrom(TypesPackage.Literals.JVM_TYPE, c);
  if (_isAssignableFrom) {
    return " to a type";
  }
  if ((c == TypesPackage.Literals.JVM_OPERATION)) {
    return " to an operation";
  }
  return "";
}
项目:xtext-extras    文件:AbstractXbaseWithAnnotationsSemanticSequencer.java   
/**
 * Contexts:
 *     XAnnotationElementValuePair returns XAnnotationElementValuePair
 *
 * Constraint:
 *     (element=[JvmOperation|ValidID] value=XAnnotationElementValue)
 */
protected void sequence_XAnnotationElementValuePair(ISerializationContext context, XAnnotationElementValuePair semanticObject) {
    if (errorAcceptor != null) {
        if (transientValues.isValueTransient(semanticObject, XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT) == ValueTransient.YES)
            errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT));
        if (transientValues.isValueTransient(semanticObject, XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE) == ValueTransient.YES)
            errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE));
    }
    SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
    feeder.accept(grammarAccess.getXAnnotationElementValuePairAccess().getElementJvmOperationValidIDParserRuleCall_0_0_0_0_1(), semanticObject.eGet(XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT, false));
    feeder.accept(grammarAccess.getXAnnotationElementValuePairAccess().getValueXAnnotationElementValueParserRuleCall_1_0(), semanticObject.getValue());
    feeder.finish();
}
项目:xtext-extras    文件:LogicalContainerAwareReentrantTypeResolver.java   
/**
 * Returns true if the container can be nested within the expression tree. First and foremost that's
 * true if the container itself is an expression. Other possible types are {@link XCasePart},
 * {@link XCatchClause} or {@link XAnnotationElementValuePair}. Clients may override.
 */
protected boolean isPartOfExpressionTree(EObject container) {
    if (container instanceof XExpression) {
        return true;
    }
    EClass type = container.eClass();
    return type == XbasePackage.Literals.XCASE_PART || type == XbasePackage.Literals.XCATCH_CLAUSE || type == XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR;
}
项目:xtext-extras    文件:JvmTypesBuilder.java   
/**
 * Translates a single {@link XAnnotation} to {@link JvmAnnotationReference} that can be added to a {@link JvmAnnotationTarget}.
 * 
 * @param anno the source annotation
 * 
 * @return a {@link JvmAnnotationReference} that can be attached to some {@link JvmAnnotationTarget}
 */
/* @Nullable */ 
public JvmAnnotationReference getJvmAnnotationReference(/* @Nullable */ XAnnotation anno) {
    if(anno == null)
        return null;
    JvmAnnotationReference reference = typesFactory.createJvmAnnotationReference();
    final JvmType annotation = (JvmType) anno.eGet(
            XAnnotationsPackage.Literals.XANNOTATION__ANNOTATION_TYPE, false);
    if (annotation.eIsProxy()) {
        JvmAnnotationType copiedProxy = TypesFactory.eINSTANCE.createJvmAnnotationType();
        ((InternalEObject)copiedProxy).eSetProxyURI(EcoreUtil.getURI(annotation));
        reference.setAnnotation(copiedProxy);
    } else if (annotation instanceof JvmAnnotationType){
        reference.setAnnotation((JvmAnnotationType) annotation);
    }
    for (XAnnotationElementValuePair val : anno.getElementValuePairs()) {
        XExpression valueExpression = val.getValue();
        JvmAnnotationValue annotationValue = toJvmAnnotationValue(valueExpression);
        if (annotationValue != null) {
            JvmOperation op = (JvmOperation) val.eGet(
                    XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT, false);
            annotationValue.setOperation(op);
            reference.getExplicitValues().add(annotationValue);
        }
    }
    if (anno.getValue() != null) {
        JvmAnnotationValue value = toJvmAnnotationValue(anno.getValue());
        if (value != null) {
            reference.getExplicitValues().add(value);
        }
    }
    associate(anno, reference);
    return reference;
}
项目:xtext-extras    文件:UnresolvedAnnotationTypeAwareMessageProvider.java   
protected boolean isPropertyOfUnresolvedAnnotation(ILinkingDiagnosticContext context) {
    EObject object = context.getContext();
    if (object instanceof XAnnotationElementValuePair && context.getReference() == XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT) {
        XAnnotation annotation = EcoreUtil2.getContainerOfType(object, XAnnotation.class);
        if (annotation != null) {
            JvmType annotationType = annotation.getAnnotationType();
            if (annotationType == null || annotationType.eIsProxy() || !(annotationType instanceof JvmAnnotationType)) {
                return true;
            }
        }
    }
    return false;
}
项目:xtext-extras    文件:XbaseCompiler.java   
protected boolean canUseArrayInitializer(XListLiteral literal, ITreeAppendable appendable) {
    if (literal.eContainingFeature() == XbasePackage.Literals.XVARIABLE_DECLARATION__RIGHT
        || literal.eContainingFeature() == XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE
        || literal.eContainingFeature() == XAnnotationsPackage.Literals.XANNOTATION__VALUE
        ) {
        return canUseArrayInitializerImpl(literal, appendable);
    }
    return false;
}
项目:xtext-extras    文件:XbasePackageImpl.java   
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 * 
 * <p>This method is used to initialize {@link XbasePackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static XbasePackage init()
{
    if (isInited) return (XbasePackage)EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI);

    // Obtain or create and register package
    XbasePackageImpl theXbasePackage = (XbasePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof XbasePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new XbasePackageImpl());

    isInited = true;

    // Initialize simple dependencies
    TypesPackage.eINSTANCE.eClass();

    // Obtain or create and register interdependencies
    XAnnotationsPackageImpl theXAnnotationsPackage = (XAnnotationsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(XAnnotationsPackage.eNS_URI) instanceof XAnnotationsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(XAnnotationsPackage.eNS_URI) : XAnnotationsPackage.eINSTANCE);
    XtypePackageImpl theXtypePackage = (XtypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI) instanceof XtypePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI) : XtypePackage.eINSTANCE);

    // Create package meta-data objects
    theXbasePackage.createPackageContents();
    theXAnnotationsPackage.createPackageContents();
    theXtypePackage.createPackageContents();

    // Initialize created meta-data
    theXbasePackage.initializePackageContents();
    theXAnnotationsPackage.initializePackageContents();
    theXtypePackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theXbasePackage.freeze();


    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(XbasePackage.eNS_URI, theXbasePackage);
    return theXbasePackage;
}
项目:xtext-extras    文件:XAnnotationsPackageImpl.java   
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 * 
 * <p>This method is used to initialize {@link XAnnotationsPackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static XAnnotationsPackage init()
{
    if (isInited) return (XAnnotationsPackage)EPackage.Registry.INSTANCE.getEPackage(XAnnotationsPackage.eNS_URI);

    // Obtain or create and register package
    XAnnotationsPackageImpl theXAnnotationsPackage = (XAnnotationsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof XAnnotationsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new XAnnotationsPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    TypesPackage.eINSTANCE.eClass();

    // Obtain or create and register interdependencies
    XtypePackageImpl theXtypePackage = (XtypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI) instanceof XtypePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI) : XtypePackage.eINSTANCE);
    XbasePackageImpl theXbasePackage = (XbasePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI) instanceof XbasePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI) : XbasePackage.eINSTANCE);

    // Create package meta-data objects
    theXAnnotationsPackage.createPackageContents();
    theXtypePackage.createPackageContents();
    theXbasePackage.createPackageContents();

    // Initialize created meta-data
    theXAnnotationsPackage.initializePackageContents();
    theXtypePackage.initializePackageContents();
    theXbasePackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theXAnnotationsPackage.freeze();


    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(XAnnotationsPackage.eNS_URI, theXAnnotationsPackage);
    return theXAnnotationsPackage;
}
项目:xtext-extras    文件:XAnnotationImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<XAnnotationElementValuePair> getElementValuePairs()
{
    if (elementValuePairs == null)
    {
        elementValuePairs = new EObjectContainmentEList<XAnnotationElementValuePair>(XAnnotationElementValuePair.class, this, XAnnotationsPackage.XANNOTATION__ELEMENT_VALUE_PAIRS);
    }
    return elementValuePairs;
}
项目:xtext-extras    文件:XAnnotationImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setAnnotationType(JvmType newAnnotationType)
{
    JvmType oldAnnotationType = annotationType;
    annotationType = newAnnotationType;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, XAnnotationsPackage.XANNOTATION__ANNOTATION_TYPE, oldAnnotationType, annotationType));
}
项目:xtext-extras    文件:XAnnotationImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetValue(XExpression newValue, NotificationChain msgs)
{
    XExpression oldValue = value;
    value = newValue;
    if (eNotificationRequired())
    {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XAnnotationsPackage.XANNOTATION__VALUE, oldValue, newValue);
        if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
}
项目:xtext-extras    文件:XAnnotationImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
    switch (featureID)
    {
        case XAnnotationsPackage.XANNOTATION__ELEMENT_VALUE_PAIRS:
            return ((InternalEList<?>)getElementValuePairs()).basicRemove(otherEnd, msgs);
        case XAnnotationsPackage.XANNOTATION__VALUE:
            return basicSetValue(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
}
项目:xtext-extras    文件:XAnnotationImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public boolean eIsSet(int featureID)
{
    switch (featureID)
    {
        case XAnnotationsPackage.XANNOTATION__ELEMENT_VALUE_PAIRS:
            return elementValuePairs != null && !elementValuePairs.isEmpty();
        case XAnnotationsPackage.XANNOTATION__ANNOTATION_TYPE:
            return annotationType != null;
        case XAnnotationsPackage.XANNOTATION__VALUE:
            return value != null;
    }
    return super.eIsSet(featureID);
}
项目:xtext-extras    文件:XAnnotationElementValuePairImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetValue(XExpression newValue, NotificationChain msgs)
{
    XExpression oldValue = value;
    value = newValue;
    if (eNotificationRequired())
    {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE, oldValue, newValue);
        if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
}
项目:xtext-extras    文件:XAnnotationElementValuePairImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setElement(JvmOperation newElement)
{
    JvmOperation oldElement = element;
    element = newElement;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT, oldElement, element));
}
项目:xtext-extras    文件:XAnnotationElementValuePairImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
    switch (featureID)
    {
        case XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE:
            return basicSetValue(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
}
项目:xtext-extras    文件:XAnnotationElementValuePairImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
    switch (featureID)
    {
        case XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE:
            return getValue();
        case XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT:
            if (resolve) return getElement();
            return basicGetElement();
    }
    return super.eGet(featureID, resolve, coreType);
}
项目:xtext-extras    文件:XAnnotationElementValuePairImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue)
{
    switch (featureID)
    {
        case XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE:
            setValue((XExpression)newValue);
            return;
        case XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT:
            setElement((JvmOperation)newValue);
            return;
    }
    super.eSet(featureID, newValue);
}
项目:xtext-extras    文件:XAnnotationElementValuePairImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
    switch (featureID)
    {
        case XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE:
            setValue((XExpression)null);
            return;
        case XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT:
            setElement((JvmOperation)null);
            return;
    }
    super.eUnset(featureID);
}
项目:xtext-extras    文件:XAnnotationElementValuePairImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public boolean eIsSet(int featureID)
{
    switch (featureID)
    {
        case XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE:
            return value != null;
        case XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT:
            return element != null;
    }
    return super.eIsSet(featureID);
}
项目:xtext-extras    文件:XtypePackageImpl.java   
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 * 
 * <p>This method is used to initialize {@link XtypePackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static XtypePackage init()
{
    if (isInited) return (XtypePackage)EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI);

    // Obtain or create and register package
    XtypePackageImpl theXtypePackage = (XtypePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof XtypePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new XtypePackageImpl());

    isInited = true;

    // Initialize simple dependencies
    TypesPackage.eINSTANCE.eClass();

    // Obtain or create and register interdependencies
    XAnnotationsPackageImpl theXAnnotationsPackage = (XAnnotationsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(XAnnotationsPackage.eNS_URI) instanceof XAnnotationsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(XAnnotationsPackage.eNS_URI) : XAnnotationsPackage.eINSTANCE);
    XbasePackageImpl theXbasePackage = (XbasePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI) instanceof XbasePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI) : XbasePackage.eINSTANCE);

    // Create package meta-data objects
    theXtypePackage.createPackageContents();
    theXAnnotationsPackage.createPackageContents();
    theXbasePackage.createPackageContents();

    // Initialize created meta-data
    theXtypePackage.initializePackageContents();
    theXAnnotationsPackage.initializePackageContents();
    theXbasePackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theXtypePackage.freeze();


    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(XtypePackage.eNS_URI, theXtypePackage);
    return theXtypePackage;
}
项目:xtext-extras    文件:XbaseHighlightingCalculator.java   
protected void highlightAnnotation(XAnnotation annotation, IHighlightedPositionAcceptor acceptor, String highlightingConfiguration) {
    JvmType annotationType = annotation.getAnnotationType();
    if (annotationType != null && !annotationType.eIsProxy() && annotationType instanceof JvmAnnotationType) {
        ICompositeNode xannotationNode = NodeModelUtils.findActualNodeFor(annotation);
        if (xannotationNode != null) {
            ILeafNode firstLeafNode = NodeModelUtils.findLeafNodeAtOffset(xannotationNode, xannotationNode.getOffset() );
            if(firstLeafNode != null)
                highlightNode(acceptor, firstLeafNode, highlightingConfiguration);
        }
        highlightReferenceJvmType(acceptor, annotation, XAnnotationsPackage.Literals.XANNOTATION__ANNOTATION_TYPE, annotationType, highlightingConfiguration);
    }
}
项目:xtext-extras    文件:AnnotationsValidatorTest.java   
@Test public void testNoOperationFound() throws Exception {
    XAnnotation annotation = annotation("@testdata.Annotation2(toString = true)", false);
    validator.assertNoError(annotation, IssueCodes.INCOMPATIBLE_TYPES);
    // TODO use better error message like in Java (e.g. Annotation A does not define an attribute b)
    validator.assertError(annotation, XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR, Diagnostic.LINKING_DIAGNOSTIC);
    validator.assertError(annotation, XAnnotationsPackage.Literals.XANNOTATION, IssueCodes.ANNOTATIONS_MISSING_ATTRIBUTE_DEFINITION, "attribute 'value'");
}
项目:dsl-devkit    文件:CheckPackageImpl.java   
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 * 
 * <p>This method is used to initialize {@link CheckPackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static CheckPackage init()
{
    if (isInited) return (CheckPackage)EPackage.Registry.INSTANCE.getEPackage(CheckPackage.eNS_URI);

    // Obtain or create and register package
    CheckPackageImpl theCheckPackage = (CheckPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CheckPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CheckPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    XAnnotationsPackage.eINSTANCE.eClass();
    XbasePackage.eINSTANCE.eClass();
    XtypePackage.eINSTANCE.eClass();
    XtextPackage.eINSTANCE.eClass();

    // Create package meta-data objects
    theCheckPackage.createPackageContents();

    // Initialize created meta-data
    theCheckPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theCheckPackage.freeze();


    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(CheckPackage.eNS_URI, theCheckPackage);
    return theCheckPackage;
}
项目:dsl-devkit    文件:AbstractCheckSemanticSequencer.java   
/**
 * Constraint:
 *     (element=[JvmOperation|ValidID] value=XAnnotationElementValue)
 */
protected void sequence_XAnnotationElementValuePair(EObject context, XAnnotationElementValuePair semanticObject) {
    if(errorAcceptor != null) {
        if(transientValues.isValueTransient(semanticObject, XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE) == ValueTransient.YES)
            errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__VALUE));
        if(transientValues.isValueTransient(semanticObject, XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT) == ValueTransient.YES)
            errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT));
    }
    INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
    SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
    feeder.accept(grammarAccess.getXAnnotationElementValuePairAccess().getElementJvmOperationValidIDParserRuleCall_0_0_0_0_1(), semanticObject.getElement());
    feeder.accept(grammarAccess.getXAnnotationElementValuePairAccess().getValueXAnnotationElementValueParserRuleCall_1_0(), semanticObject.getValue());
    feeder.finish();
}
项目:xtext-extras    文件:XbaseWithAnnotationsValidator.java   
@Override
protected List<EPackage> getEPackages() {
    final List<EPackage> ePackages = newArrayList(super.getEPackages());
    ePackages.add(XAnnotationsPackage.eINSTANCE);
    return ePackages;
}
项目:xtext-extras    文件:XAnnotationImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected EClass eStaticClass()
{
    return XAnnotationsPackage.Literals.XANNOTATION;
}
项目:xtext-extras    文件:XAnnotationElementValuePairImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected EClass eStaticClass()
{
    return XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR;
}
项目:xtext-extras    文件:XbaseWithAnnotationsStandaloneSetup.java   
@Override
public Injector createInjectorAndDoEMFRegistration() {
  EPackage.Registry.INSTANCE.put(XAnnotationsPackage.eINSTANCE.getNsURI(), XAnnotationsPackage.eINSTANCE);
  return super.createInjectorAndDoEMFRegistration();
}
项目:xtext-extras    文件:AnnotationsValidatorTest.java   
@Test public void testTypeConformance_09() throws Exception {
    XAnnotation annotation = annotation("@testdata.Annotation1(true)", false);
    validator.assertError(annotation, XAnnotationsPackage.Literals.XANNOTATION, IssueCodes.ANNOTATIONS_MISSING_ATTRIBUTE_DEFINITION, "children");
}