Skip to main content


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 JakobikFriend
Messages: 12
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 JakobikFriend
Messages: 12
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 Mising name is currently offline Peter Mising nameFriend
Messages: 95
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:Iterative export of ecore to UML2
Next Topic:createClass and createOwnedClass
Goto Forum:
  


Current Time: Thu Apr 25 14:35:03 GMT 2024

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

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

Back to the top