Standalone: load profile from Papyrus models [message #1777371] |
Tue, 28 November 2017 19:02  |
Eclipse User |
|
|
|
Hi, I have to parse some UML models created with Papyrus in a standalone application.
These models refer a (unregistered) UML profile stored in the same project as the models files (also same directory, actually).
When I try to load the models from outside Eclipse the profile application is lost: load is successful but when looking for stereotypes applied to the elements I cannot find them.
It seems like the resource loader is usable to deal with the way the profile is referenced.
I'm using the basic standard standalone setup (I hope):
ResourceSet set = new ResourceSetImpl();
UMLResourcesUtil.init(set);
set.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
set.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
Resource resource = set.getResource(URI.createFileURI(new File(umlModelFilename).getAbsolutePath()), true);
resource.load(null);
UMLResource umlResource = (UMLResource)resource;
By looking at the XMIs they references the profile as "/projectname/src/main/resources/the.profile.uml" (yes, that's a Maven structure, the standalone app is a Maven plugin...).
If I change that to "the.profile.uml" everything works just fine, I guess I'm just cheating the resource loader.
Anyway: which is the clean and correct way to deal with this situation?
Thanks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Standalone: load profile from Papyrus models [message #1777595 is a reply to message #1777516] |
Thu, 30 November 2017 11:15  |
Eclipse User |
|
|
|
German Vega wrote on Wed, 29 November 2017 16:08Hi again Davide,
I haven't tried it, but should work
Very well possible but I see a lot of corner cases... waiting to know if that's a Papyrus issue I'm going to support only profiles not applied in the creation wizard.
[Updated on: Thu, 30 November 2017 18:54] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.34581 seconds