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


Java ResourceFactoryImpl类代码示例

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


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

示例1: getQualifiedName

import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; //导入依赖的package包/类
/**
 * @param selections
 * @return
 */
public static String getQualifiedName(final ITreeSelection selections) {
  final TreePath[] paths = selections.getPaths();

  // Consider only not empty and single selection
  if (selections.isEmpty() || selections.size() > 1) {
    return null;
  }

  final TreePath path = paths[0];
  IElementComparer comparer = null;
  if (selections instanceof TreeSelection) {
    comparer = ((TreeSelection) selections).getElementComparer();
  }
  System.out.println(path.hashCode(comparer));
  for (int i = 1; i < path.getSegmentCount(); i++) {
    if (path.getSegment(i) instanceof ResourceFactoryImpl) {
      final EcoreResourceFactoryImpl eResourceFactory =
          (EcoreResourceFactoryImpl) path.getSegment(i);
      System.out
          .println(eResourceFactory.getClass().getName() + ": " + eResourceFactory.toString());
    } else if (path.getSegment(i) instanceof ENamedElement) {
      final ENamedElement namedElement = (ENamedElement) path.getSegment(i);
      System.out.println(namedElement.getClass().getName() + ": " + namedElement.getName());
    } else {
      System.out.println("?");
    }
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:34,代码来源:MarkerFactory.java

示例2: setUp

import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
	super.setUp();
	factory = new ResourceFactoryImpl(){
		@Override
		public Resource createResource(URI uri) {
			XtextResource resource = new XtextResource();
			injectMembers(resource);
			resource.setLinker(get(Linker.class));
			resource.setURI(uri);
			return resource;
		}
	};
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("bug287988testlanguage", factory);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:16,代码来源:Bug287988WithEagerLinkingTest.java

示例3: setupResources

import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; //导入依赖的package包/类
private static void setupResources() {
	EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);

	Map<String, Object> extMappings = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
	extMappings.put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
	extMappings.put(null, new ResourceFactoryImpl());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:8,代码来源:StandaloneUtil.java

示例4: export

import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; //导入依赖的package包/类
public String export(String id) throws Exception {
	this.createHeader(id);

	ResourceFactoryImpl resourceFactory = new XMLPersistenceMappingResourceFactoryImpl();
	URI emfURI = URI.createURI("http://kay-muench.de", true);
	XMLResource resource = (XMLResource) resourceFactory
			.createResource(emfURI);

	resource.setEncoding("UTF-8");
	resource.getContents().add(getReqIF());

	OutputStream os = new ByteArrayOutputStream();
	resource.save(os, null);
	return os.toString();
}
 
开发者ID:KayErikMuench,项目名称:reqiftools,代码行数:16,代码来源:ReqIF10Compiler.java

示例5: createResourceFactoryImpl

import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; //导入依赖的package包/类
protected ResourceFactoryImpl createResourceFactoryImpl() {
	return new XMIResourceFactoryImpl() {
		@Override
		public Resource createResource(URI uri) {
			return new XMIFragmentImpl(uri, null);
		}
	};
}
 
开发者ID:markus1978,项目名称:emf-fragments,代码行数:9,代码来源:AbstractReflectiveModelTests.java

示例6: theTest

import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; //导入依赖的package包/类
@Test
public void theTest() throws Exception {
	EPackage.Registry.INSTANCE.put(EcorePackage.eINSTANCE.getNsURI(), EcorePackage.eINSTANCE);
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new ResourceFactoryImpl() {
		@Override
		public Resource createResource(URI uri) {			
			return new BinaryResourceImpl(uri);
		}			
	});
	Resource resource = new ResourceSetImpl().createResource(URI.createURI("test.ecore"));
	EPackage thePkg = EcoreFactory.eINSTANCE.createEPackage();
	resource.getContents().add(thePkg);
	thePkg.setName("ThePkg");
	EClass lastClass = null;
	for (int i = 0; i < 10000; i++) {
		EClass newClass = EcoreFactory.eINSTANCE.createEClass();
		newClass.setName("Class" + i);
		thePkg.getEClassifiers().add(newClass);
		if (lastClass != null) {
			EReference ref = EcoreFactory.eINSTANCE.createEReference();
			ref.setName("ref");
			ref.setEType(newClass);
			lastClass.getEStructuralFeatures().add(ref);
		}
		lastClass = newClass;
	}
	
	resource.save(null);
}
 
开发者ID:markus1978,项目名称:emf-fragments,代码行数:30,代码来源:EmfSaveLargeChainTest.java

示例7: createResourceSet

import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; //导入依赖的package包/类
/**
 * Creates a prepared {@link ResourceSet} with some registered factories.
 * Produced resources by extensions are:
 * <ul>
 * <li>.xmi uses {@link XMIResourceImpl}</li>
 * <li>.bin uses {@link BinaryResourceImpl}</li>
 * <li>.ecore uses {@link XMIResourceImpl}</li>
 * <li>.* uses {@link XMIResourceImpl}</li>
 * </ul>
 * This method can be override in order to change the basic ResourceSet used
 * by this wrapper.
 * 
 * @return a configured ResourceSet
 */
protected static ResourceSet createResourceSet() {
	ResourceSet result = new ResourceSetImpl();
	result.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
	result.getResourceFactoryRegistry().getExtensionToFactoryMap().put("bin", new ResourceFactoryImpl() {
		@Override
		public Resource createResource(URI uri) {
			return new BinaryResourceImpl(uri);
		}
	});
	result.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
	result.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
	return result;
}
 
开发者ID:aranega,项目名称:dynemf,代码行数:28,代码来源:ResourceSetWrapper.java


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