Search in sources :

Example 1 with SingleCrossReference

use of org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference in project xtext-core by eclipse.

the class TokenSerializerTest method testConstructedCrossReferenceWithProxy.

@Test
public void testConstructedCrossReferenceWithProxy() {
    final XtextResourceSet resourceSet = this.resourceSetProvider.get();
    Resource _createResource = resourceSet.createResource(this.getFileURI("dummy"));
    final XtextResource resource = ((XtextResource) _createResource);
    Model _createModel = this.factory.createModel();
    final Procedure1<Model> _function = (Model it) -> {
        SingleCrossReference _createSingleCrossReference = this.factory.createSingleCrossReference();
        final Procedure1<SingleCrossReference> _function_1 = (SingleCrossReference it_1) -> {
            it_1.setName("myref");
        };
        SingleCrossReference _doubleArrow = ObjectExtensions.<SingleCrossReference>operator_doubleArrow(_createSingleCrossReference, _function_1);
        it.setX5(_doubleArrow);
    };
    final Model model = ObjectExtensions.<Model>operator_doubleArrow(_createModel, _function);
    EList<EObject> _contents = resource.getContents();
    _contents.add(model);
    SingleCrossReference _x5 = model.getX5();
    SingleCrossReference _createSingleCrossReference = this.factory.createSingleCrossReference();
    final Procedure1<SingleCrossReference> _function_1 = (SingleCrossReference it) -> {
        ((InternalEObject) it).eSetProxyURI(resource.getURI().appendFragment("foo"));
    };
    SingleCrossReference _doubleArrow = ObjectExtensions.<SingleCrossReference>operator_doubleArrow(_createSingleCrossReference, _function_1);
    _x5.setRef3(_doubleArrow);
    resource.setFragmentProvider(new DefaultFragmentProvider() {

        @Override
        public EObject getEObject(final Resource resource, final String fragment, final IFragmentProvider.Fallback fallback) {
            EObject _xifexpression = null;
            boolean _equals = Objects.equal(fragment, "foo");
            if (_equals) {
                _xifexpression = model.getX5();
            } else {
                _xifexpression = super.getEObject(resource, fragment, fallback);
            }
            return _xifexpression;
        }
    });
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("#5 myref kw3 myref");
    _builder.newLine();
    this.assertSerializesTo(model, _builder);
}
Also used : XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) XtextResource(org.eclipse.xtext.resource.XtextResource) XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) Model(org.eclipse.xtext.serializer.syntacticsequencertest.Model) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) SingleCrossReference(org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference) IFragmentProvider(org.eclipse.xtext.resource.IFragmentProvider) DefaultFragmentProvider(org.eclipse.xtext.resource.DefaultFragmentProvider) Test(org.junit.Test)

Example 2 with SingleCrossReference

use of org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference in project xtext-core by eclipse.

the class ModelImpl method basicSetX5.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetX5(SingleCrossReference newX5, NotificationChain msgs) {
    SingleCrossReference oldX5 = x5;
    x5 = newX5;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SyntacticsequencertestPackage.MODEL__X5, oldX5, newX5);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) SingleCrossReference(org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference)

Example 3 with SingleCrossReference

use of org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference in project xtext-core by eclipse.

the class SingleCrossReferenceImpl method setRef2.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setRef2(SingleCrossReference newRef2) {
    SingleCrossReference oldRef2 = ref2;
    ref2 = newRef2;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, SyntacticsequencertestPackage.SINGLE_CROSS_REFERENCE__REF2, oldRef2, ref2));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) SingleCrossReference(org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference)

Example 4 with SingleCrossReference

use of org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference in project xtext-core by eclipse.

the class SingleCrossReferenceImpl method setRef3.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setRef3(SingleCrossReference newRef3) {
    SingleCrossReference oldRef3 = ref3;
    ref3 = newRef3;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, SyntacticsequencertestPackage.SINGLE_CROSS_REFERENCE__REF3, oldRef3, ref3));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) SingleCrossReference(org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference)

Example 5 with SingleCrossReference

use of org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference in project xtext-core by eclipse.

the class SingleCrossReferenceImpl method setRef4.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setRef4(SingleCrossReference newRef4) {
    SingleCrossReference oldRef4 = ref4;
    ref4 = newRef4;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, SyntacticsequencertestPackage.SINGLE_CROSS_REFERENCE__REF4, oldRef4, ref4));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) SingleCrossReference(org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference)

Aggregations

SingleCrossReference (org.eclipse.xtext.serializer.syntacticsequencertest.SingleCrossReference)7 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)5 Model (org.eclipse.xtext.serializer.syntacticsequencertest.Model)2 EObject (org.eclipse.emf.ecore.EObject)1 EPackage (org.eclipse.emf.ecore.EPackage)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 DefaultFragmentProvider (org.eclipse.xtext.resource.DefaultFragmentProvider)1 IFragmentProvider (org.eclipse.xtext.resource.IFragmentProvider)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)1 ActionOnly (org.eclipse.xtext.serializer.syntacticsequencertest.ActionOnly)1 Add0 (org.eclipse.xtext.serializer.syntacticsequencertest.Add0)1 Add1 (org.eclipse.xtext.serializer.syntacticsequencertest.Add1)1 Add2 (org.eclipse.xtext.serializer.syntacticsequencertest.Add2)1 AlternativeTransition (org.eclipse.xtext.serializer.syntacticsequencertest.AlternativeTransition)1