[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.mdt.uml2] Re: UML2 Stereotypes missing when loading standalone; works correctly when running as plugin

Philip,

If you don't need that other profile stuff, fun, but did you take note of the resource factory that's being used?


Philip Mayer wrote:

Dear Ed,

yes, I've read that FAQ entry, whioh seems to require me to explicitely load the uml2 JAR. I'd rather not do this for obvious reasons, and as of now all class handling issues have been handled perfectly by Eclipse for me.

So, is there any other way of doing this which does not require the URI to the JAR file?

Thanks,

Philip

Ed Merks wrote:
Philip,

I think this is a FAQ

http://wiki.eclipse.org/MDT/UML2/FAQ#What.27s_required_to_load_a_UML_.28.uml.29_resource_from_a_standalone_application.3F




Philip Mayer wrote:
Hi all,

I have worked successfully with UML 2.0.0 models, including applied stereotypes, exported from MagicDraw in my plugins for quite some time now. MagicDraw exports several .uml files - one is my project, the others are profiles, among them my own. They are referenced in the project.uml file.

When I load the main file *in a plugin* with the following code, everything is fine and I can get a correct list of applied stereotypes for an element with element.getAppliedStereotypes().

fInputResourceSet= new ResourceSetImpl();
fInputResource= fInputResourceSet.getResource(fileURI, true);

So far, so good. Now, I'm running the code not as a plugin, but *standalone* (aim is to have faster test cases). I therefore register the necessary packages before I execute the above code to load the model:

EPackage.Registry.INSTANCE.put("http://www.eclipse.org/uml2/2.0.0/UML";, UMLPackage.eINSTANCE);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("uml", new XMIResourceFactoryImpl());


Now, I can read the UML model just as before and get all the elements, correctly typed. However, a call to element.getAppliedStereotypes() ALWAYS returns [].

What am I missing? There are no exceptions or error messages I am aware of.

Thanks,

Philip