load correctly an UML profile [message #642946] |
Fri, 03 December 2010 13:27 |
smaoui asma Messages: 50 Registered: July 2009 Location: Paris Saclay, France |
Member |
|
|
Hello everybody,
I tried to load an UML profile manually (in a java class):
public void registerPackages(ResourceSet resourceSet) {
super.registerPackages(resourceSet);
resourceSet.getPackageRegistry().put(UMLPackage.eINSTANCE.ge tNsURI(), UMLPackage.eINSTANCE);
// TODO If you need additional package registrations, do them here. The following line is an example for UML.
resourceSet.getPackageRegistry().put(HLAMPackage.eINSTANCE.g etNsURI(), HLAMPackage.eINSTANCE);
/* resourceSet.getPackageRegistry().put(EcorePackage.eINSTANCE. getNsURI(), EcorePackage.eINSTANCE);*/
Map uriMap = resourceSet.getURIConverter().getURIMap();
URI uri = URI.createURI(" jar:file:/export/home/charfi/Bureau/Logiciel/eclipse/plugins /org.eclipse.papyrus.marte.static.profile_0.7.1.201011231845 .jar!/ ");
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("resources").appendSegment(""));
/*URI uri = URI.createURI(" jar:file:/export/home/charfi/Bureau/Logiciel/eclipse/plugins /org.eclipse.uml2.uml.resources_3.1.1.v201008191505.jar!/ ");
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment(""));*/
}
public void registerResourceFactories(ResourceSet resourceSet) {
super.registerResourceFactories(resourceSet);
// TODO If you need additional resource factories registrations, do them here
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.PROFILE_FILE_EXTENSION, HLAMFactory.eINSTANCE);
}
for the Ecore profile, this works very well, I can print the profile name, the used stereotype name etc.
when I try to load the HLAÙ profile (sub profile of the MARTE profile), and print the profile name I get this:
org.eclipse.uml2.uml.internal.impl.ProfileImpl@121fd61 (eProxyURI: pathmap://Papyrus_PROFILES/MARTE.profile.uml#_yNSZIAPMEdyuUt -4qHuVvQ)
instead of :
org.eclipse.uml2.uml.internal.impl.ProfileImpl@1df7735 (name: HLAM, visibility: <unset>)
the MARTE.profile.uml is located in the resources folder of je jar file: jar:file:/export/home/charfi/Bureau/Logiciel/eclipse/plugins /org.eclipse.papyrus.marte.static.profile_0.7.1.201011231845 .jar
just like the Ecore.profile.uml which is located in the folder profiles of the jar file jar:file:/export/home/charfi/Bureau/Logiciel/eclipse/plugins /org.eclipse.uml2.uml.resources_3.1.1.v201008191505.jar
did I miss something to load corectly the profile, cause the (eProxyURI: pathmap://Papyrus_PROFILES/MARTE.profile.uml#_yNSZIAPMEdyuUt -4qHuVvQ) means that the EMF did not recognize my profile although the refernce is the rignt reference of the HLAM profile.
thank you very much
Asma.
|
|
|
|
Powered by
FUDForum. Page generated in 0.23878 seconds