Search in sources :

Example 1 with Stuff

use of org.eclipse.xtext.ui.tests.foo.Stuff in project xtext-eclipse by eclipse.

the class AbstractScopeResourceDescriptionsTest method assertLiveModelScopeExternalFile.

protected void assertLiveModelScopeExternalFile(boolean enabled) throws CoreException, InvocationTargetException, InterruptedException {
    String pathName = "test/test." + fileExt.getPrimaryFileExtension();
    String pathName2 = "test/test2." + fileExt.getPrimaryFileExtension();
    String model = "stuff A refs B";
    createFile(pathName, model);
    createFile(pathName2, "stuff B");
    waitForBuild();
    final URI resourceURI = URI.createPlatformResourceURI(pathName, true);
    Resource resource = resourceSet.getResource(resourceURI, true);
    assertExportedObject(resource, "A");
    Stuff elementA = ((File) resource.getContents().get(0)).getStuff().get(0);
    Stuff elementB = elementA.getRefs();
    assertFalse(elementB.eIsProxy());
    elementA.setName("C");
    elementB.setName("D");
    if (enabled) {
        assertExportedObject(elementA.eResource(), "C");
        assertExportedObject(elementB.eResource(), "D");
    } else {
        assertExportedObject(elementA.eResource(), "A");
        assertExportedObject(elementB.eResource(), "B");
    }
}
Also used : XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) IDirtyResource(org.eclipse.xtext.ui.editor.IDirtyResource) Stuff(org.eclipse.xtext.ui.tests.foo.Stuff) URI(org.eclipse.emf.common.util.URI)

Example 2 with Stuff

use of org.eclipse.xtext.ui.tests.foo.Stuff in project xtext-eclipse by eclipse.

the class AbstractScopeResourceDescriptionsTest method assertLiveModelScopeLocal.

protected void assertLiveModelScopeLocal(boolean enabled) throws IOException {
    final URI resourceURI = URI.createPlatformResourceURI("test/assertLiveModelScopeLocal." + fileExt.getPrimaryFileExtension(), true);
    Resource resource = resourceSet.createResource(resourceURI);
    resource.load(new StringInputStream("stuff foo"), null);
    Stuff stuffFoo = ((File) resource.getContents().get(0)).getStuff().get(0);
    if (enabled) {
        assertExportedObject(resource, "foo");
        stuffFoo.setName("bar");
        assertExportedObject(resource, "bar");
    } else {
        IResourceDescriptions resourceDescriptions = resourceDescriptionsProvider.getResourceDescriptions(resource);
        IResourceDescription resourceDescription = resourceDescriptions.getResourceDescription(resource.getURI());
        assertNull(resourceDescription);
    }
}
Also used : StringInputStream(org.eclipse.xtext.util.StringInputStream) IResourceDescription(org.eclipse.xtext.resource.IResourceDescription) IResourceDescriptions(org.eclipse.xtext.resource.IResourceDescriptions) XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) IDirtyResource(org.eclipse.xtext.ui.editor.IDirtyResource) Stuff(org.eclipse.xtext.ui.tests.foo.Stuff) URI(org.eclipse.emf.common.util.URI)

Example 3 with Stuff

use of org.eclipse.xtext.ui.tests.foo.Stuff in project xtext-eclipse by eclipse.

the class StuffImpl method setRefs.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setRefs(Stuff newRefs) {
    Stuff oldRefs = refs;
    refs = newRefs;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, FooPackage.STUFF__REFS, oldRefs, refs));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) Stuff(org.eclipse.xtext.ui.tests.foo.Stuff)

Example 4 with Stuff

use of org.eclipse.xtext.ui.tests.foo.Stuff in project xtext-eclipse by eclipse.

the class TestLanguageSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == FooPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case FooPackage.FILE:
                sequence_File(context, (File) semanticObject);
                return;
            case FooPackage.STUFF:
                sequence_Stuff(context, (Stuff) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Parameter(org.eclipse.xtext.Parameter) Stuff(org.eclipse.xtext.ui.tests.foo.Stuff) File(org.eclipse.xtext.ui.tests.foo.File) EPackage(org.eclipse.emf.ecore.EPackage)

Aggregations

Stuff (org.eclipse.xtext.ui.tests.foo.Stuff)4 URI (org.eclipse.emf.common.util.URI)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 XtextResource (org.eclipse.xtext.resource.XtextResource)2 IDirtyResource (org.eclipse.xtext.ui.editor.IDirtyResource)2 EPackage (org.eclipse.emf.ecore.EPackage)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 IResourceDescription (org.eclipse.xtext.resource.IResourceDescription)1 IResourceDescriptions (org.eclipse.xtext.resource.IResourceDescriptions)1 File (org.eclipse.xtext.ui.tests.foo.File)1 StringInputStream (org.eclipse.xtext.util.StringInputStream)1