Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Stereoytpes are not applied after serialization!
Stereoytpes are not applied after serialization! [message #628418] Thu, 29 April 2010 10:44
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi all,

i've a problem in applying stereotypes programmatically. At first, i
must say that stereotypes being applied via the "UML Editor" (Element ->
Apply Stereotype) works as expected. That's why i'm pretty sure that the
profile itself is implemented correctly. The profile is realized as a
static profile.

What is the problem:
I try to apply a profile and its stereotype programmatically during a
transformation (handwritten in plain java). Although i'm able to load
and apply the profile as well as the stereotypes, only the applied
profile remains after saving the model. Even the XMI doesn't contain
these additional stereotype entries. But only after serialization! If i
ask (at the end of the transformation) for the profile and the specific
stereotypes, everything is accessbile and present. After serialization,
only the applied profile remains.

Here is the snippet, how the profile is applied by me (don't care for
the prefixes and the uri's. They are correct).

ResourceSet set = new ResourceSetImpl();

final Model model = UMLFactory.eINSTANCE.createModel();

final Profile prof =
(Profile)set.getResource(URI.createURI("platform:plugin/staticProfile/model/my.profile.uml "),

org.eclipse.uml2.uml.Class clazz = model.createOwnedClass("TestClass",
final Stereotype s = clazz.getApplicableStereotype("my::Extension");

final Resource r = UMLResource.Factory.INSTANCE.createResource(uri);
try {;
} catch (IOException e) {
// TODO Auto-generated catch block

I really didn't understand the problem... what am i doing wrong?

Thanks in advance
Previous Topic:Attribute Types
Next Topic:create InterfaceRealization issue
Goto Forum:

Current Time: Fri Jun 22 23:12:32 GMT 2018

Powered by FUDForum. Page generated in 0.01383 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top