Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » How to add an InstanceSpecification to a Package
How to add an InstanceSpecification to a Package [message #757279] Thu, 17 November 2011 13:02 Go to next message
Andreas Jakobik is currently offline Andreas Jakobik
Messages: 6
Registered: November 2011
Junior Member
Hi,

I feel a bit silly to ask this probably simple UML2 API question but browsing the JavaDoc and asking my collegues did not help, so here it goes:

How can I add an org.eclipse.uml2.uml.InstanceSpecificationto an org.eclipse.uml2.uml.Package? The following code snippet creates a package and an instance specification, but how do I add the instance specification to the package?

Package package = model.createNestedPackage("MyInstancePackage");
InstanceSpecification is = UMLFactory.eINSTANCE.createInstanceSpecification();
// package.someMethod(is) <--- ???


Thanks a lot!

/Andreas
Re: How to add an InstanceSpecification to a Package [message #757756 is a reply to message #757279] Mon, 21 November 2011 13:59 Go to previous message
Andreas Jakobik is currently offline Andreas Jakobik
Messages: 6
Registered: November 2011
Junior Member

This was really easy as expected:

instancePackage.getPackagedElements().add(is);
Re: How to add an InstanceSpecification to a Package [message #758017 is a reply to message #757279] Thu, 17 November 2011 13:35 Go to previous message
Peter  is currently offline Peter
Messages: 85
Registered: July 2009
Member
Hi Andreas,
simply use
package.getPackagedElements().add(instance);
Greetings
Peter
Am Do 17.11.11 14:02, schrieb Andreas Jakobik:
> Hi,
>
> I feel a bit silly to ask this probably simple UML2 API question but
> browsing the JavaDoc and asking my collegues did not help, so here it goes:
>
> How can I add an org.eclipse.uml2.uml.InstanceSpecificationto an
> org.eclipse.uml2.uml.Package? The following code snippet creates a
> package and an instance specification, but how do I add the instance
> specification to the package?
>
> Package package = model.createNestedPackage("MyInstancePackage");
> InstanceSpecification is =
> UMLFactory.eINSTANCE.createInstanceSpecification();
> // package.someMethod(is) <--- ???
> Thanks a lot!
>
> /Andreas
Previous Topic:Help applying RDF/ODM profile
Next Topic:createClass and createOwnedClass
Goto Forum:
  


Current Time: Fri Sep 19 03:47:35 GMT 2014

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

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