當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。