当前位置: 首页>>代码示例>>Java>>正文


Java IResourceFactory类代码示例

本文整理汇总了Java中org.eclipse.xtext.resource.IResourceFactory的典型用法代码示例。如果您正苦于以下问题:Java IResourceFactory类的具体用法?Java IResourceFactory怎么用?Java IResourceFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IResourceFactory类属于org.eclipse.xtext.resource包,在下文中一共展示了IResourceFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Resource load(final ResourceSet resourceSet, final URI uri, final InputStream input) throws IOException {
	final Injector injector = IXtInjectorProvider.INSTANCE.getInjector(context.get(XpectJavaModel.class), uri);
	final Resource resource = injector.getInstance(IResourceFactory.class).createResource(uri);
	final Resource existingResousce = from(resourceSet.getResources())
			.firstMatch(r -> r.getURI().equals(resource.getURI())).orNull();
	if (null != existingResousce) {
		// remove the existing one
		resourceSet.getResources().remove(existingResousce);
	}
	resourceSet.getResources().add(resource);
	try {
		resource.load(input, null);
	} finally {
		if (input != null)
			input.close();
	}
	return resource;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:DuplicateResourceAwareFileSetupContext.java

示例2: transformContent

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
protected String transformContent(IResourceFactory resourceFactory) {
	BufferedReader reader = new BufferedReader(new StringReader(content));
	try {
		try {
			StringWriter writer = new StringWriter(content.length());
			PrintWriter printer = new PrintWriter(writer);
			String line = reader.readLine();
			while (line != null) {
				line = transfromLine(line, resourceFactory);
				printer.println(line);
				line = reader.readLine();
			}
			printer.close();
			return writer.toString();
		} finally {
			reader.close();
		}
	} catch (IOException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:UnorderedGroupsSplitter.java

示例3: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	if (!EPackage.Registry.INSTANCE.containsKey("http://www.baernreuther.de/dsls/Pkmntcgo")) {
		EPackage.Registry.INSTANCE.put("http://www.baernreuther.de/dsls/Pkmntcgo", PkmntcgoPackage.eINSTANCE);
	}
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ptcgo", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("ptcgo", serviceProvider);
}
 
开发者ID:rehne93,项目名称:pokemon-tcgo-deck-generator,代码行数:11,代码来源:PkmntcgoStandaloneSetupGenerated.java

示例4: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4ts", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4ts", serviceProvider);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:TypesStandaloneSetupGenerated.java

示例5: createThisResource

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
/**
 * Creates {@link N4JSResource} in new {@link ResourceSet}. Created resource has uri of processed xt file and its
 * context. During creation resource factory is obtained dynamically to preserve bindings created by XPECT (see
 * {@link org.eclipse.xpect.xtext.lib.tests.ValidationTestModuleSetup#configure})
 *
 */
@Creates(ThisResource.class)
public XtextResource createThisResource() throws IOException, CoreException {

	Entry<IFile, IProject> file2project = findTestResources();
	IFile xpectFile = file2project.getKey();
	IProject userProject = file2project.getValue();

	ResourceSet resourceSet = resourceSetProvider.get(userProject);
	URI xpectFilePlatformURI = URI.createPlatformResourceURI(xpectFile.getFullPath().toString(),
			ENCODE_PLATFORM_RESOURCE_URIS);

	Injector injector = IXtInjectorProvider.INSTANCE.getInjector(ctx.get(XpectJavaModel.class),
			xpectFilePlatformURI);
	Resource resource = injector.getInstance(IResourceFactory.class).createResource(xpectFilePlatformURI);

	resourceSet.getResources().add(resource);
	InputStream input = xpectFile.getContents();

	try {
		resource.load(input, null);
	} finally {
		if (input != null)
			input.close();
	}
	return (XtextResource) resource;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:33,代码来源:N4IDEXpectFileSetup.java

示例6: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/n4js/regex/RegularExpression")) {
		EPackage.Registry.INSTANCE.put("http://www.eclipse.org/n4js/regex/RegularExpression", RegularExpressionPackage.eINSTANCE);
	}
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("regex", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("regex", serviceProvider);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:RegularExpressionStandaloneSetupGenerated.java

示例7: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4js", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4js", serviceProvider);
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4jsx", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4jsx", serviceProvider);
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("js", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("js", serviceProvider);
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("jsx", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("jsx", serviceProvider);
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4jsd", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4jsd", serviceProvider);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:N4JSStandaloneSetupGenerated.java

示例8: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4mf", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4mf", serviceProvider);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:N4MFStandaloneSetupGenerated.java

示例9: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	if (!EPackage.Registry.INSTANCE.containsKey("http://www.xtext.org/example/mydsl/MyDsl")) {
		EPackage.Registry.INSTANCE.put("http://www.xtext.org/example/mydsl/MyDsl", MyDslPackage.eINSTANCE);
	}
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("mensa", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("mensa", serviceProvider);
}
 
开发者ID:fatalerrortan,项目名称:Xtext_Xtend_HTML_Generator,代码行数:11,代码来源:MyDslStandaloneSetupGenerated.java

示例10: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	if (!EPackage.Registry.INSTANCE.containsKey("http://www.hribol.com/bromium/dsl/Bromium")) {
		EPackage.Registry.INSTANCE.put("http://www.hribol.com/bromium/dsl/Bromium", BromiumPackage.eINSTANCE);
	}
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("brm", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("brm", serviceProvider);
}
 
开发者ID:hristo-vrigazov,项目名称:bromium,代码行数:11,代码来源:BromiumStandaloneSetupGenerated.java

示例11: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.gw4e/dsl/DSLPolicies")) {
		EPackage.Registry.INSTANCE.put("http://www.eclipse.gw4e/dsl/DSLPolicies", DSLPoliciesPackage.eINSTANCE);
	}
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("policies", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("policies", serviceProvider);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:11,代码来源:DSLPoliciesStandaloneSetupGenerated.java

示例12: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	if (!EPackage.Registry.INSTANCE.containsKey("http://www.wamas.com/ide/launching/LcDsl")) {
		EPackage.Registry.INSTANCE.put("http://www.wamas.com/ide/launching/LcDsl", LcDslPackage.eINSTANCE);
	}
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("lc", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("lc", serviceProvider);
}
 
开发者ID:mduft,项目名称:lcdsl,代码行数:11,代码来源:LcDslStandaloneSetupGenerated.java

示例13: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/gemoc/Dsl")) {
		EPackage.Registry.INSTANCE.put("http://www.eclipse.org/gemoc/Dsl", DslPackage.eINSTANCE);
	}
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("dsl", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("dsl", serviceProvider);
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:11,代码来源:DslStandaloneSetupGenerated.java

示例14: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	if (!EPackage.Registry.INSTANCE.containsKey("http://www.xtext.org/dsl/restaurante/Restaurante")) {
		EPackage.Registry.INSTANCE.put("http://www.xtext.org/dsl/restaurante/Restaurante", RestaurantePackage.eINSTANCE);
	}
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("rest", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("rest", serviceProvider);
}
 
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:11,代码来源:RestauranteStandaloneSetupGenerated.java

示例15: register

import org.eclipse.xtext.resource.IResourceFactory; //导入依赖的package包/类
public void register(Injector injector) {
	IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
	IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("occi", resourceFactory);
	IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("occi", serviceProvider);
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:8,代码来源:OCCIStandaloneSetupGenerated.java


注:本文中的org.eclipse.xtext.resource.IResourceFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。