Search in sources :

Example 6 with EcoreResourceFactoryImpl

use of org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl in project xtext-core by eclipse.

the class ResourceSetBasedResourceDescriptionsTest method createResource.

private Resource createResource() {
    Resource resource = new EcoreResourceFactoryImpl().createResource(URI.createURI("test://uri" + nameCount++ + ".ecore"));
    resourceSet.getResources().add(resource);
    return resource;
}
Also used : EcoreResourceFactoryImpl(org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl) Resource(org.eclipse.emf.ecore.resource.Resource)

Example 7 with EcoreResourceFactoryImpl

use of org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl in project xtext-core by eclipse.

the class SrcSegmentsInUrisAreNotRemovedTests method setUp.

@Before
public void setUp() throws Exception {
    globalStateMemento = GlobalRegistries.makeCopyOfGlobalState();
    EPackage.Registry.INSTANCE.put(XMLTypePackage.eNS_URI, XMLTypePackage.eINSTANCE);
    EcoreResourceFactoryImpl resFactory = new EcoreResourceFactoryImpl();
    set.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", resFactory);
    aRes = (XMIResource) set.createResource(URI.createPlatformResourceURI("/myProject/main/src/some/package/a.ecore", true));
    InputStream stream = new ByteArrayInputStream(aResContent.getBytes("US-ASCII"));
    aRes.load(stream, set.getLoadOptions());
    stream.close();
    bRes = (XMIResource) set.createResource(URI.createPlatformResourceURI("/myProject/model/b.ecore", true));
    stream = new ByteArrayInputStream(bResContent.getBytes("US-ASCII"));
    bRes.load(stream, set.getLoadOptions());
    stream.close();
}
Also used : EcoreResourceFactoryImpl(org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Before(org.junit.Before)

Example 8 with EcoreResourceFactoryImpl

use of org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl in project xtext-xtend by eclipse.

the class XtendStandaloneSetup method createInjectorAndDoEMFRegistration.

@Override
public Injector createInjectorAndDoEMFRegistration() {
    boolean _containsKey = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore");
    boolean _not = (!_containsKey);
    if (_not) {
        Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
        EcoreResourceFactoryImpl _ecoreResourceFactoryImpl = new EcoreResourceFactoryImpl();
        _extensionToFactoryMap.put("ecore", _ecoreResourceFactoryImpl);
    }
    boolean _containsKey_1 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi");
    boolean _not_1 = (!_containsKey_1);
    if (_not_1) {
        Map<String, Object> _extensionToFactoryMap_1 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
        XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl();
        _extensionToFactoryMap_1.put("xmi", _xMIResourceFactoryImpl);
    }
    boolean _containsKey_2 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin");
    boolean _not_2 = (!_containsKey_2);
    if (_not_2) {
        Map<String, Object> _extensionToFactoryMap_2 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
        BinaryGrammarResourceFactoryImpl _binaryGrammarResourceFactoryImpl = new BinaryGrammarResourceFactoryImpl();
        _extensionToFactoryMap_2.put("xtextbin", _binaryGrammarResourceFactoryImpl);
    }
    boolean _containsKey_3 = EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI);
    boolean _not_3 = (!_containsKey_3);
    if (_not_3) {
        EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);
    }
    EPackage.Registry.INSTANCE.put(XtendPackage.eINSTANCE.getNsURI(), XtendPackage.eINSTANCE);
    EPackage.Registry.INSTANCE.put(XbasePackage.eINSTANCE.getNsURI(), XbasePackage.eINSTANCE);
    EPackage.Registry.INSTANCE.put(XAnnotationsPackage.eINSTANCE.getNsURI(), XAnnotationsPackage.eINSTANCE);
    EPackage.Registry.INSTANCE.put(TypesPackage.eINSTANCE.getNsURI(), TypesPackage.eINSTANCE);
    EPackage.Registry.INSTANCE.put(XtypePackage.eINSTANCE.getNsURI(), XtypePackage.eINSTANCE);
    Injector injector = this.createInjector();
    this.register(injector);
    return injector;
}
Also used : EcoreResourceFactoryImpl(org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl) Injector(com.google.inject.Injector) XMIResourceFactoryImpl(org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl) BinaryGrammarResourceFactoryImpl(org.eclipse.xtext.resource.impl.BinaryGrammarResourceFactoryImpl)

Example 9 with EcoreResourceFactoryImpl

use of org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl in project xtext-core by eclipse.

the class Bug292245TestLanguageStandaloneSetupGenerated method createInjectorAndDoEMFRegistration.

@Override
public Injector createInjectorAndDoEMFRegistration() {
    // register default ePackages
    if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
    if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
    if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xtextbin", new BinaryGrammarResourceFactoryImpl());
    if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
        EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);
    Injector injector = createInjector();
    register(injector);
    return injector;
}
Also used : EcoreResourceFactoryImpl(org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl) Injector(com.google.inject.Injector) XMIResourceFactoryImpl(org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl) BinaryGrammarResourceFactoryImpl(org.eclipse.xtext.resource.impl.BinaryGrammarResourceFactoryImpl)

Example 10 with EcoreResourceFactoryImpl

use of org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl in project xtext-core by eclipse.

the class XtextTerminalsTestLanguageStandaloneSetupGenerated method createInjectorAndDoEMFRegistration.

@Override
public Injector createInjectorAndDoEMFRegistration() {
    // register default ePackages
    if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
    if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
    if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xtextbin", new BinaryGrammarResourceFactoryImpl());
    if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
        EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);
    Injector injector = createInjector();
    register(injector);
    return injector;
}
Also used : EcoreResourceFactoryImpl(org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl) Injector(com.google.inject.Injector) XMIResourceFactoryImpl(org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl) BinaryGrammarResourceFactoryImpl(org.eclipse.xtext.resource.impl.BinaryGrammarResourceFactoryImpl)

Aggregations

EcoreResourceFactoryImpl (org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl)18 Injector (com.google.inject.Injector)13 XMIResourceFactoryImpl (org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl)13 BinaryGrammarResourceFactoryImpl (org.eclipse.xtext.resource.impl.BinaryGrammarResourceFactoryImpl)13 EObject (org.eclipse.emf.ecore.EObject)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)2 Before (org.junit.Before)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 URI (org.eclipse.emf.common.util.URI)1 EPackage (org.eclipse.emf.ecore.EPackage)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 GeneratedMetamodelImpl (org.eclipse.xtext.impl.GeneratedMetamodelImpl)1 DerivedStateAwareResource (org.eclipse.xtext.resource.DerivedStateAwareResource)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1