Skip to main content



      Home
Home » Modeling » UML2 » How to add comments for any Model Object
How to add comments for any Model Object [message #478120] Wed, 14 January 2009 05:27 Go to next message
Eclipse UserFriend
Hi All;

By using given types of code, I am comfortable to generate any type of
Model Object like Class, Activity, Edge, Control Flow etc.


org.eclipse.uml2.uml.Class class = package.createOwnedClass("My Class",
isAbstract);


But I am unable to add/generate the comment tag in the generated .uml
file. Due to not given any method like setComments() etc.


Please let me tell that How can I add comments in my .uml file for any
generated model object.



Thanks in Advance
Kishore
Re: How to add comments for any Model Object [message #478122 is a reply to message #478120] Wed, 14 January 2009 10:41 Go to previous messageGo to next message
Eclipse UserFriend
Hi Kishore,

Element exposes a createOwnedComment() method, or you could call
getOwnedComments().add(myComment).
Since every type in uml extends uml:Element, you should be able to add
comments to any uml Element.

Cheers,
- James.


"kishore " <kishore_74_lko@yahoo.com> wrote in message
news:14e308cec209e0387ecc167aec660fa8$1@www.eclipse.org...
> Hi All;
>
> By using given types of code, I am comfortable to generate any type of
> Model Object like Class, Activity, Edge, Control Flow etc.
>
> org.eclipse.uml2.uml.Class class = package.createOwnedClass("My Class",
> isAbstract);
>
>
> But I am unable to add/generate the comment tag in the generated .uml
> file. Due to not given any method like setComments() etc.
>
>
> Please let me tell that How can I add comments in my .uml file for any
> generated model object.
>
>
>
> Thanks in Advance
> Kishore
Re: How to add comments for any Model Object [message #478124 is a reply to message #478122] Wed, 14 January 2009 13:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Even to comments!

;-)


James Bruck wrote:
> Hi Kishore,
>
> Element exposes a createOwnedComment() method, or you could call
> getOwnedComments().add(myComment).
> Since every type in uml extends uml:Element, you should be able to add
> comments to any uml Element.
>
> Cheers,
> - James.

-----8<-----
Re: How to add comments for any Model Object [message #478125 is a reply to message #478124] Wed, 14 January 2009 16:55 Go to previous messageGo to next message
Eclipse UserFriend
Very interesting .. that's a good point. Thanks for pointing that out.

- James.

"Christian W. Damus" <cdamus@zeligsoft.com> wrote in message
news:gklars$emf$1@build.eclipse.org...
> Even to comments!
>
> ;-)
>
>
> James Bruck wrote:
>> Hi Kishore,
>>
>> Element exposes a createOwnedComment() method, or you could call
>> getOwnedComments().add(myComment).
>> Since every type in uml extends uml:Element, you should be able to add
>> comments to any uml Element.
>>
>> Cheers,
>> - James.
>
> -----8<-----
Re: How to add comments for any Model Object [message #478126 is a reply to message #478125] Fri, 16 January 2009 17:42 Go to previous message
Eclipse UserFriend
Note that, technically, there is a difference between the owner of a comment
(which will be assigned when using the factory method James referenced) and
the elements to which the comment applies (which will not be automatically
assigned). To indicate that an element is annotated by a comment (i.e. that
the comment applies to it), you'll need to add it like this:

myComment.getAnnotatedElements().add(myElement);

It's probably most common for the owner of a comment to be (one of) the
annotated element(s), but this isn't necessarily always the case...

Kenn

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:gklmsg$slm$1@build.eclipse.org...
> Very interesting .. that's a good point. Thanks for pointing that out.
>
> - James.
>
> "Christian W. Damus" <cdamus@zeligsoft.com> wrote in message
> news:gklars$emf$1@build.eclipse.org...
>> Even to comments!
>>
>> ;-)
>>
>>
>> James Bruck wrote:
>>> Hi Kishore,
>>>
>>> Element exposes a createOwnedComment() method, or you could call
>>> getOwnedComments().add(myComment).
>>> Since every type in uml extends uml:Element, you should be able to add
>>> comments to any uml Element.
>>>
>>> Cheers,
>>> - James.
>>
>> -----8<-----
>
>
Re: How to add comments for any Model Object [message #627328 is a reply to message #478120] Wed, 14 January 2009 10:41 Go to previous message
Eclipse UserFriend
Hi Kishore,

Element exposes a createOwnedComment() method, or you could call
getOwnedComments().add(myComment).
Since every type in uml extends uml:Element, you should be able to add
comments to any uml Element.

Cheers,
- James.


"kishore " <kishore_74_lko@yahoo.com> wrote in message
news:14e308cec209e0387ecc167aec660fa8$1@www.eclipse.org...
> Hi All;
>
> By using given types of code, I am comfortable to generate any type of
> Model Object like Class, Activity, Edge, Control Flow etc.
>
> org.eclipse.uml2.uml.Class class = package.createOwnedClass("My Class",
> isAbstract);
>
>
> But I am unable to add/generate the comment tag in the generated .uml
> file. Due to not given any method like setComments() etc.
>
>
> Please let me tell that How can I add comments in my .uml file for any
> generated model object.
>
>
>
> Thanks in Advance
> Kishore
Re: How to add comments for any Model Object [message #627330 is a reply to message #478122] Wed, 14 January 2009 13:28 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Even to comments!

;-)


James Bruck wrote:
> Hi Kishore,
>
> Element exposes a createOwnedComment() method, or you could call
> getOwnedComments().add(myComment).
> Since every type in uml extends uml:Element, you should be able to add
> comments to any uml Element.
>
> Cheers,
> - James.

-----8<-----
Re: How to add comments for any Model Object [message #627331 is a reply to message #478124] Wed, 14 January 2009 16:55 Go to previous message
Eclipse UserFriend
Very interesting .. that's a good point. Thanks for pointing that out.

- James.

"Christian W. Damus" <cdamus@zeligsoft.com> wrote in message
news:gklars$emf$1@build.eclipse.org...
> Even to comments!
>
> ;-)
>
>
> James Bruck wrote:
>> Hi Kishore,
>>
>> Element exposes a createOwnedComment() method, or you could call
>> getOwnedComments().add(myComment).
>> Since every type in uml extends uml:Element, you should be able to add
>> comments to any uml Element.
>>
>> Cheers,
>> - James.
>
> -----8<-----
Re: How to add comments for any Model Object [message #627332 is a reply to message #478125] Fri, 16 January 2009 17:42 Go to previous message
Eclipse UserFriend
Note that, technically, there is a difference between the owner of a comment
(which will be assigned when using the factory method James referenced) and
the elements to which the comment applies (which will not be automatically
assigned). To indicate that an element is annotated by a comment (i.e. that
the comment applies to it), you'll need to add it like this:

myComment.getAnnotatedElements().add(myElement);

It's probably most common for the owner of a comment to be (one of) the
annotated element(s), but this isn't necessarily always the case...

Kenn

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:gklmsg$slm$1@build.eclipse.org...
> Very interesting .. that's a good point. Thanks for pointing that out.
>
> - James.
>
> "Christian W. Damus" <cdamus@zeligsoft.com> wrote in message
> news:gklars$emf$1@build.eclipse.org...
>> Even to comments!
>>
>> ;-)
>>
>>
>> James Bruck wrote:
>>> Hi Kishore,
>>>
>>> Element exposes a createOwnedComment() method, or you could call
>>> getOwnedComments().add(myComment).
>>> Since every type in uml extends uml:Element, you should be able to add
>>> comments to any uml Element.
>>>
>>> Cheers,
>>> - James.
>>
>> -----8<-----
>
>
Previous Topic:[Announce] MDT UML2 3.0.0 I200901141028 is available
Next Topic:Middleweight UML extension: creating specific Operations
Goto Forum:
  


Current Time: Wed Jul 23 19:34:41 EDT 2025

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

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

Back to the top