/**
* @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;
}
java类org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl的实例源码
MarkerFactory.java 文件源码
项目:Tarski
阅读 28
收藏 0
点赞 0
评论 0
Bug287988WithEagerLinkingTest.java 文件源码
项目:xtext-core
阅读 19
收藏 0
点赞 0
评论 0
@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);
}
MarkerFactory.java 文件源码
项目:WP3
阅读 27
收藏 0
点赞 0
评论 0
/**
* @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;
}
StandaloneUtil.java 文件源码
项目:textuml
阅读 20
收藏 0
点赞 0
评论 0
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());
}
ReqIF10Compiler.java 文件源码
项目:reqiftools
阅读 19
收藏 0
点赞 0
评论 0
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();
}
AbstractReflectiveModelTests.java 文件源码
项目:emf-fragments
阅读 20
收藏 0
点赞 0
评论 0
protected ResourceFactoryImpl createResourceFactoryImpl() {
return new XMIResourceFactoryImpl() {
@Override
public Resource createResource(URI uri) {
return new XMIFragmentImpl(uri, null);
}
};
}
EmfSaveLargeChainTest.java 文件源码
项目:emf-fragments
阅读 20
收藏 0
点赞 0
评论 0
@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);
}
ResourceSetWrapper.java 文件源码
项目:dynemf
阅读 25
收藏 0
点赞 0
评论 0
/**
* 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;
}
ResourceSetWrapper.java 文件源码
项目:dynemf
阅读 69
收藏 0
点赞 0
评论 0
/**
* 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;
}