Java 类org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl 实例源码

项目:statecharts    文件:SimulationImageRenderer.java   
private Resource reload(IFile file) {
    final URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
    Factory factory = ResourceFactoryRegistryImpl.INSTANCE.getFactory(uri);
    Resource resource = factory.createResource(uri);
    ResourceSet resourceSet = new ResourceSetImpl();
    TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
    resourceSet.getResources().add(resource);
    try {
        resource.load(Collections.EMPTY_MAP);
    } catch (IOException e) {
        throw new IllegalStateException("Error loading resource", e);
    }
    return resource;
}
项目:statecharts    文件:ResourceUtil.java   
public static Resource loadResource(String filename) {
    URI uri = URI.createPlatformResourceURI(filename, true);
    Factory factory = ResourceFactoryRegistryImpl.INSTANCE.getFactory(uri);
    Resource resource = factory.createResource(uri);
    ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResources().add(resource);
    try {
        resource.load(Collections.EMPTY_MAP);
        return resource;
    } catch (IOException e) {
        throw new IllegalStateException("Error loading resource", e);
    }
}