|
|
|
Re: Loading UML_21.ecore model from a standalone java app [message #628151 is a reply to message #628146] |
Tue, 29 December 2009 13:03  |
Eclipse User |
|
|
|
I tried to follow uml2 standlone faq but i am still getting the getEPackage() as null on one class only (EmodelElement).
EmodelElement is a superclass of the ELement class.
EPackage currPackage = superType.getEClassifier().getEPackage();
this always returns null for the Element class superclass EmodelElement as i expalined in the emf group.
I am starting to think that this maybe has nothing to do with uml.
output----------------------
[java] Loading metamodel ... uml
[java] class Comment {
[java] }
[java] class Element {
[java] eClass proxy:false
[java] superType proxy:false
[java] classifier proxy:true
parser-----------------
//EGenericType superType=null;
System.out.println(" class " + eClass.getName() +" {");
for (EGenericType superType : eClass.getEGenericSuperTypes()) {
//String typeName = getTypeName(superType, eClass);
EPackage currPackage = superType.getEClassifier().getEPackage();
if(currPackage==null){
System.out.println("eClass proxy:"+eClass.eIsProxy());
System.out.println("superType proxy:"+superType.eIsProxy());
System.out.println("classifier proxy:"+superType.getEClassifier().eIsProxy());
}else {
}
}
uml2------------
protected void loadUml2MetaModel(ResourceSet resourceSet) {
EPackage.Registry reg1;
reg1 = resourceSet.getPackageRegistry();
reg1.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
reg1.put(UML212UMLResource.UML_METAMODEL_NS_URI, UMLPackage.eINSTANCE);
Factory.Registry reg2;
reg2 = resourceSet.getResourceFactoryRegistry();
reg2.getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSI ON,
UMLResource.Factory.INSTANCE);
Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
URI uri = URI
.createURI(" jar:file:./lib/ecore/org.eclipse.uml2.uml.resources_3.0.0.v2 00906011111.jar!/ ");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri
.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri
.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri
.appendSegment("profiles").appendSegment(""));
}
|
|
|
Powered by
FUDForum. Page generated in 0.05793 seconds