Skip to main content



      Home
Home » Modeling » UML2 » Problem adding comment
Problem adding comment [message #559452] Thu, 16 September 2010 12:41 Go to next message
Eclipse UserFriend
Hi,

I'm adding a comment to a Port and then edit it to set some values:

Comment comment = portCopy.createOwnedComment(); comment.applyStereotype(stereoRtSpec);
portCopy.setValue(stereoRtFeature, "specification", comment);

But I can't see the comment in the model viewer, I'm I attaching it in the wrong place?

Thanks in advance, 123star
Re: Problem adding comment [message #559542 is a reply to message #559452] Fri, 17 September 2010 02:21 Go to previous messageGo to next message
Eclipse UserFriend
Comment comment = portCopy.createOwnedComment(); 

That will create the comment as a child of the port, but the comment will not be tied to any element. To do that, you need to add the port as an annotated element

comment.getAnnotatedtElements().add(portCopy);

That should take care of the problem (even though I don't know what you are referring to when you say "model viewer") .

However, it seems you also want to apply a stereotype to the comment:

comment.applyStereotype(stereoRtSpec);

That is fine, but then the following line does not make sense:

portCopy.setValue(stereoRtFeature, "specification", comment);

What are you trying to achieve there?

Since you applied the stereotype to the comment, you can only set the tagged value on the comment itself (assuming "specification" is a property in the stereotype, it is now an extended attribute of the element you applied the stereotype to).

Cheers,

Rafael
http://alphasimple.com
Re: Problem adding comment [message #559591 is a reply to message #559452] Fri, 17 September 2010 06:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
thank you very much for your reply:

the line is wrong:

portCopy.setValue(stereoRtFeature, "specification", comment);

correct one:

comment.setValue(stereoRtSpec, "context", op);

But remains the problem that I can't see the comment in the Model Explorer (Model view).

123star


Re: Problem adding comment [message #559753 is a reply to message #559591] Fri, 17 September 2010 17:18 Go to previous message
Eclipse UserFriend
Sorry, I don't know what "Model explorer" is. Google tells me Papyrus has such thing, so if that is what you are referring to, you might want to ask this question on their newsgroup, as this is the forum for the UML2 API.

Or you can paste the XMI you are generating and we can try to help find problems with the model itself, but diagram rendering issues should be taken to the corresponding forum for the tool you are using.

Cheers,

Rafael
Previous Topic:How to create an association(link) on an object diagram programmatically?
Next Topic:Creating connector
Goto Forum:
  


Current Time: Wed Jul 23 00:18:44 EDT 2025

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

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

Back to the top