Java 类org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl 实例源码

项目:ttc2017smartGrids    文件:Task2PackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:ttc2017smartGrids    文件:GluemodelPackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded) return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    }
    catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:ttc2017smartGrids    文件:Task1PackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:ttc2017smartGrids    文件:COSEMPackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded) return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    }
    catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:ttc2017smartGrids    文件:CIMPackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded) return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    }
    catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:n4js    文件:UnicodeStandaloneSetupGenerated.java   
@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;
}
项目:BIMplatform    文件:Ifc2x3tc1PackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:BIMplatform    文件:GeometryPackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:BIMplatform    文件:LogPackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:BIMplatform    文件:Ifc4PackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:BIMplatform    文件:StorePackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:rgse.ttc17.emoflon.tgg    文件:Task2PackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:rgse.ttc17.emoflon.tgg    文件:GluemodelPackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded) return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    }
    catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:rgse.ttc17.emoflon.tgg    文件:Task1PackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:gemoc-studio    文件:DslStandaloneSetupGenerated.java   
@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;
}
项目:SurveyDSL    文件:SurveyGenerator.java   
private static Survey loadSurveyModel(String modulePath) {
    // Initialize the model
    QueryITPackage.eINSTANCE.eClass();

    Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
    Map<String, Object> m = reg.getExtensionToFactoryMap();
    m.put("xmi", new XMIResourceFactoryImpl());
    m.put("ecore", new EcoreResourceFactoryImpl());

    // Obtain a new resource set
    ResourceSet resSet = new ResourceSetImpl();

    // Get the resource
    //Resource resource = resSet.getResource(URI.createFileURI(modulePath), true);
    Resource resource = resSet.getResource(URI.createURI(modulePath), true);

    // Get the first model element and cast it to the right type, in my
    // example everything is included in this first node
    Survey s = (Survey) resource.getContents().get(0);

    return s;
}
项目:xtext-extras    文件:XtypeStandaloneSetupGenerated.java   
@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;
}
项目:xtext-extras    文件:AbstractPortableURIsTest.java   
@Before
public void setUp() throws Exception {
    globalStateMemento = GlobalRegistries.makeCopyOfGlobalState();
    EPackage.Registry.INSTANCE.put(XMLTypePackage.eNS_URI, XMLTypePackage.eINSTANCE);
    resourceSet = new XtextResourceSet();
    resourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
    resourceSet.getPackageRegistry().put(GenModelPackage.eNS_URI, GenModelPackage.eINSTANCE);
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("genmodel", new EcoreResourceFactoryImpl());
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
    resourceSet.getURIConverter().getURIMap().put(URI.createPlatformPluginURI("org.eclipse.xtext/", false), URI.createURI("classpath:/"));
    resourceSet.getURIConverter().getURIMap().put(URI.createPlatformPluginURI("org.eclipse.xtext.xbase/", false), URI.createURI("classpath:/"));
    resourceSet.getURIConverter().getURIMap().put(URI.createPlatformPluginURI("org.eclipse.xtext.common.types/", false), URI.createURI("classpath:/"));
    resourceSet.getURIConverter().getURIMap().put(URI.createPlatformResourceURI("org.eclipse.emf.ecore/", false), URI.createURI("classpath:/"));
    resourceSet.getURIConverter().getURIMap().put(URI.createPlatformResourceURI("org.eclipse.xtext.xbase/", false), URI.createURI("classpath:/"));
    resourceSet.getURIConverter().getURIMap().put(URI.createPlatformResourceURI("org.eclipse.xtext.common.types/", false), URI.createURI("classpath:/"));
    resourceSet.getLoadOptions().put(XMLResource.OPTION_URI_HANDLER, this);
    resourceSet.setClasspathURIContext(getClasspathURIContext());
}
项目:xtext-extras    文件:SrcSegmentsInUrisAreNotRemovedTests.java   
@Before
public void setUp() throws Exception {

    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();

}
项目:Vitruv    文件:Models.java   
public static Resource loadModel(URL modelURL) {

        ResourceSet resSet = new ResourceSetImpl();
        resSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
                new XMIResourceFactoryImpl());

        EcoreResourceFactoryImpl ecoreResFact = new EcoreResourceFactoryImpl();
        URI fileName = BasicTestCase.getURI(modelURL);
        LOGGER.info("Trying to load " + fileName);
        Resource ecoreRes = ecoreResFact.createResource(fileName);
        try {
            ecoreRes.load(null);
        } catch (IOException e) {
            fail("Could not load " + Files.EXAMPLEMODEL_ECORE.getFile() + ". Reason: " + e);
        }

        resSet.getResources().add(ecoreRes);

        return ecoreRes;
    }
项目:xtext-core    文件:TerminalsStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:XtextLinkingService.java   
private List<EObject> createPackage(GeneratedMetamodel generatedMetamodel, ILeafNode text) {
    final String nsURI = getMetamodelNsURI(text);
    final URI uri = URI.createURI(nsURI);
    if (uri == null || isReferencedByUsedGrammar(generatedMetamodel, nsURI))
        return Collections.emptyList();
    EPackage pack = ((GeneratedMetamodelImpl)generatedMetamodel).basicGetEPackage();
    if (pack != null && !pack.eIsProxy())
        return singletonList((EObject)pack);
    final EPackage generatedEPackage = EcoreFactory.eINSTANCE.createEPackage();
    generatedEPackage.setName(generatedMetamodel.getName());
    generatedEPackage.setNsPrefix(generatedMetamodel.getName());
    generatedEPackage.setNsURI(nsURI);
    final Resource generatedPackageResource = new EcoreResourceFactoryImpl().createResource(uri);
    XtextResourceSet resourceSet = (XtextResourceSet) generatedMetamodel.eResource().getResourceSet();
    if (!resourceSet.getURIResourceMap().containsKey(generatedPackageResource.getURI())) {
        generatedMetamodel.eResource().getResourceSet().getResources().add(generatedPackageResource);
    } else {
        generatedPackageResource.setURI(URI.createURI(nsURI+"_"+generatedMetamodel.hashCode()));
        generatedMetamodel.eResource().getResourceSet().getResources().add(generatedPackageResource);
    }
    generatedPackageResource.getContents().add(generatedEPackage);
    return Collections.<EObject>singletonList(generatedEPackage);
}
项目:xtext-core    文件:Bug406914TestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:Bug301935TestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:HiddenTerminalsTestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:Bug292245TestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:XtextTerminalsTestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:TerminalRulesTestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:EcoreTerminalsTestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:EncodingTestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:IndentationAwareTestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:BacktrackingLexerTestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:IgnoreCaseLexerTestLanguageStandaloneSetupGenerated.java   
@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;
}
项目:xtext-core    文件:SrcSegmentsInUrisAreNotRemovedTests.java   
@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();

}
项目:umple    文件:UmplePackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage()
{
  if (isLoaded) return;
  isLoaded = true;

  URL url = getClass().getResource(packageFilename);
  if (url == null)
  {
    throw new RuntimeException("Missing serialized package: " + packageFilename);
  }
  URI uri = URI.createURI(url.toString());
  Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
  try
  {
    resource.load(null);
  }
  catch (IOException exception)
  {
    throw new WrappedException(exception);
  }
  initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
  createResource(eNS_URI);
}
项目:ATLauncher    文件:ATLLauncher.java   
private String lazyMetamodelRegistration(String metamodelPath){

    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());

    ResourceSet rs = new ResourceSetImpl();
    // Enables extended meta-data, weird we have to do this but well...
    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(EPackage.Registry.INSTANCE);
    rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

    Resource r = rs.getResource(URI.createFileURI(metamodelPath), true);
    EObject eObject = r.getContents().get(0);
    // A meta-model might have multiple packages we assume the main package is the first one listed
    if (eObject instanceof EPackage) {
        EPackage p = (EPackage)eObject;
        System.out.println(p.getNsURI());
        EPackage.Registry.INSTANCE.put(p.getNsURI(), p);
        return p.getNsURI();
    }
    return null;
}
项目:SecureBPMN    文件:Securebpmn2PackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: "
                + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents()
            .get(0));
    createResource(eNS_URI);
}
项目:SecureBPMN    文件:Bpmn2PackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: "
                + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents()
            .get(0));
    createResource(eNS_URI);
}
项目:SAMPLE-CODE-PUBLIC    文件:Iso20022PackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded) return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    }
    catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
    createResource(eNS_URI);
}
项目:mm-dsl    文件:MMDSLPackageImpl.java   
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage()
{
  if (isLoaded) return;
  isLoaded = true;

  URL url = getClass().getResource(packageFilename);
  if (url == null)
  {
    throw new RuntimeException("Missing serialized package: " + packageFilename);
  }
  URI uri = URI.createURI(url.toString());
  Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
  try
  {
    resource.load(null);
  }
  catch (IOException exception)
  {
    throw new WrappedException(exception);
  }
  initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
  createResource(eNS_URI);
}