Add an association into a package [message #472491] |
Thu, 05 April 2007 10:41  |
Eclipse User |
|
|
|
Originally posted by: guillaume.clement.gmail.com
Hi,
I'm able to buil associations and their properties (linked to classes).
But I'm still looking for the way to add an association to a package.
I looked into the UML2 tutorial but I don't find it.
Best regards.
Guillaume
|
|
|
|
|
|
Re: Add an association into a package [message #472504 is a reply to message #472502] |
Tue, 10 April 2007 09:47  |
Eclipse User |
|
|
|
Hi Guillaume,
The getting started article...
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getti ng_Started_with_UML2/article.html
explains this in the section: "Creating Associations"
It does something like the following:
Association association = type1.createAssociation(end1IsNavigable,
end1Aggregation, end1Name, end1LowerBound,
end1UpperBound, type2, end2IsNavigable, end2Aggregation,
end2Name, end2LowerBound, end2UpperBound);
Look at: TypeImpl.java at createAssociation() to see the details of how
the association is set up. Also, have a look at TypeOperations.java for
more gory details. Don't call the TypeOperations directly since these are
internal API, just have a look at how the associations are created. You can
either make the same calls or use the convenience API's to create your
association in one step.
Regards,
- James.
"Guillaume Clement" <guillaume.clement@gmail.com> wrote in message
news:47dce21f7272073433a48af8c702a049$1@www.eclipse.org...
> Here is the code I use to create association and properties.
> I just want to associate 2 classes.
>
>
> Association association = UMLFactory.eINSTANCE.createAssociation();
>
> Class class1 = UMLFactory.eINSTANCE.createClass();
> class1.setName("Classe1");
>
> Class class2 = UMLFactory.eINSTANCE.createClass();
> class2.setName("Classe1");
>
> Property porp1 = association.createNavigableOwnedEnd("test", class1);
>
> Property porp2 = association.createNavigableOwnedEnd("test2", class2);
>
> But I'm not able (don't know how to do that ;-( ) to add this builded
> association into my package.
>
|
|
|
Re: Add an association into a package [message #605444 is a reply to message #472491] |
Thu, 05 April 2007 11:37  |
Eclipse User |
|
|
|
Guillaume,
Which tutorial are you referring to? This is covered in the "Getting Started
with UML2" article available on the documenation page...
Kenn
"Guillaume Clement" <guillaume.clement@gmail.com> wrote in message
news:5c13b8998fd9b836c9501263190b808c$1@www.eclipse.org...
> Hi,
>
> I'm able to buil associations and their properties (linked to classes).
>
> But I'm still looking for the way to add an association to a package.
>
> I looked into the UML2 tutorial but I don't find it.
>
> Best regards.
>
> Guillaume
>
>
>
|
|
|
|
Re: Add an association into a package [message #607430 is a reply to message #472501] |
Tue, 10 April 2007 04:23  |
Eclipse User |
|
|
|
Originally posted by: guillaume.clement.gmail.com
Here is the code I use to create association and properties.
I just want to associate 2 classes.
Association association = UMLFactory.eINSTANCE.createAssociation();
Class class1 = UMLFactory.eINSTANCE.createClass();
class1.setName("Classe1");
Class class2 = UMLFactory.eINSTANCE.createClass();
class2.setName("Classe1");
Property porp1 = association.createNavigableOwnedEnd("test", class1);
Property porp2 = association.createNavigableOwnedEnd("test2", class2);
But I'm not able (don't know how to do that ;-( ) to add this builded
association into my package.
|
|
|
Re: Add an association into a package [message #607434 is a reply to message #472502] |
Tue, 10 April 2007 09:47  |
Eclipse User |
|
|
|
Hi Guillaume,
The getting started article...
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getti ng_Started_with_UML2/article.html
explains this in the section: "Creating Associations"
It does something like the following:
Association association = type1.createAssociation(end1IsNavigable,
end1Aggregation, end1Name, end1LowerBound,
end1UpperBound, type2, end2IsNavigable, end2Aggregation,
end2Name, end2LowerBound, end2UpperBound);
Look at: TypeImpl.java at createAssociation() to see the details of how
the association is set up. Also, have a look at TypeOperations.java for
more gory details. Don't call the TypeOperations directly since these are
internal API, just have a look at how the associations are created. You can
either make the same calls or use the convenience API's to create your
association in one step.
Regards,
- James.
"Guillaume Clement" <guillaume.clement@gmail.com> wrote in message
news:47dce21f7272073433a48af8c702a049$1@www.eclipse.org...
> Here is the code I use to create association and properties.
> I just want to associate 2 classes.
>
>
> Association association = UMLFactory.eINSTANCE.createAssociation();
>
> Class class1 = UMLFactory.eINSTANCE.createClass();
> class1.setName("Classe1");
>
> Class class2 = UMLFactory.eINSTANCE.createClass();
> class2.setName("Classe1");
>
> Property porp1 = association.createNavigableOwnedEnd("test", class1);
>
> Property porp2 = association.createNavigableOwnedEnd("test2", class2);
>
> But I'm not able (don't know how to do that ;-( ) to add this builded
> association into my package.
>
|
|
|
Powered by
FUDForum. Page generated in 0.28624 seconds