Add an association into a package [message #472491] |
Thu, 05 April 2007 14: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 #472502 is a reply to message #472501] |
Tue, 10 April 2007 08: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 #472504 is a reply to message #472502] |
Tue, 10 April 2007 13:47 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
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 #607430 is a reply to message #472501] |
Tue, 10 April 2007 08: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 13:47 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
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.03731 seconds