Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » how to save a model with applied stereotypes and tag values
how to save a model with applied stereotypes and tag values [message #473229] Fri, 22 June 2007 10:37 Go to next message
Eclipse UserFriend
Originally posted by: kengkaj_s.nomagicasia.com

Saving an EMF model skips any stereotype applications and tag-value
assignments that are part of that model.
Re: how to save a model with applied stereotypes and tag values [message #473232 is a reply to message #473229] Fri, 22 June 2007 17:33 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Try making your save look something like this ...
Stereotype applications are kept at root level.

protected static void save(org.eclipse.uml2.uml.Package package_, URI uri)
{
Resource resource = RESOURCE_SET.createResource(uri);
EList contents = resource.getContents();
contents.add(package_);

for (Iterator allContents = UMLUtil.getAllContents(package_, true,
false); allContents.hasNext();) {
EObject eObject = (EObject) allContents.next();

if (eObject instanceof Element) {
contents
.addAll(((Element) eObject).getStereotypeApplications());
}
}
try {
resource.save(null);

out("Done.");
} catch (IOException ioe) {
err(ioe.getMessage());
}
}

"Kengkaj" <kengkaj_s@nomagicasia.com> wrote in message
news:f5g8i4$pmv$1@build.eclipse.org...
> Saving an EMF model skips any stereotype applications and tag-value
> assignments that are part of that model.
>
>
Re: how to save a model with applied stereotypes and tag values [message #621884 is a reply to message #473229] Fri, 22 June 2007 17:33 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Try making your save look something like this ...
Stereotype applications are kept at root level.

protected static void save(org.eclipse.uml2.uml.Package package_, URI uri)
{
Resource resource = RESOURCE_SET.createResource(uri);
EList contents = resource.getContents();
contents.add(package_);

for (Iterator allContents = UMLUtil.getAllContents(package_, true,
false); allContents.hasNext();) {
EObject eObject = (EObject) allContents.next();

if (eObject instanceof Element) {
contents
.addAll(((Element) eObject).getStereotypeApplications());
}
}
try {
resource.save(null);

out("Done.");
} catch (IOException ioe) {
err(ioe.getMessage());
}
}

"Kengkaj" <kengkaj_s@nomagicasia.com> wrote in message
news:f5g8i4$pmv$1@build.eclipse.org...
> Saving an EMF model skips any stereotype applications and tag-value
> assignments that are part of that model.
>
>
Previous Topic:UML repository instance
Next Topic:java.lang.IllegalArgumentException at applyStereotype
Goto Forum:
  


Current Time: Sat Apr 20 00:47:34 GMT 2024

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

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

Back to the top