本文整理汇总了Java中org.eclipse.emf.ecore.resource.Resource.Factory.createResource方法的典型用法代码示例。如果您正苦于以下问题:Java Factory.createResource方法的具体用法?Java Factory.createResource怎么用?Java Factory.createResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.ecore.resource.Resource.Factory
的用法示例。
在下文中一共展示了Factory.createResource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reload
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入方法依赖的package包/类
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;
}
示例2: loadResource
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入方法依赖的package包/类
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);
}
}
示例3: copy
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入方法依赖的package包/类
public static Resource copy(final Factory factory, final Resource resource) {
final Resource newResource = factory.createResource(resource.getURI());
newResource.setTimeStamp(resource.getTimeStamp());
newResource.setModified(resource.isModified());
newResource.getContents().addAll(EcoreUtil.copyAll(resource.getContents()));
return newResource;
}
示例4: createXtextResource
import org.eclipse.emf.ecore.resource.Resource.Factory; //导入方法依赖的package包/类
protected XtextResource createXtextResource() {
URI resourceURI = URI.createURI("test.encodingtestlanguage");
Factory factory = Resource.Factory.Registry.INSTANCE.getFactory(resourceURI);
XtextResource resource = (XtextResource) factory.createResource(resourceURI);
return resource;
}