Skip to main content



      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 08:02 Go to next message
Eclipse UserFriend
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 08:59 Go to previous message
Eclipse UserFriend

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 08:35 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 15:07:14 EDT 2025

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

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

Back to the top