Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Comment doesn't show in model view
Comment doesn't show in model view [message #631986] Mon, 11 October 2010 07:19 Go to next message
123star  is currently offline 123star
Messages: 70
Registered: June 2010
Member
Hi,

in my program I create a Comment like this:

// owner is a Class
// port is a port of owner

Comment comment = owner.createOwnedComment();
comment.getAnnotatedElements().add(port);

But as mentioned, it doesn't show in the model view and after creating the view, it doesn't show in the editor neither.

I already asked on uml2 forum, I did what they told, but no results, so they told me to ask here.

Thanks in advance, 123star


Re: Comment doesn't show in model view [message #632007 is a reply to message #631986] Mon, 11 October 2010 08:02 Go to previous messageGo to next message
Patrick Tessier is currently offline Patrick Tessier
Messages: 142
Registered: July 2009
Senior Member
Hi 123star,

It seems peculiar:

How do you create your comment.?Do you use the framework gmf, by using palette creation command?

Or do you execute a semantic command and then do you call the drop command?

It could be important, because commands are executed in the context of a transaction.

Notifications have been done only at this end of the transaction.
In the case of the framework of gmf (transaction contains semantic creation +view creation) So it can be the reason that you see only the comment after the view creation.

Patrick
Re: Comment doesn't show in model view [message #632083 is a reply to message #631986] Mon, 11 October 2010 13:57 Go to previous message
123star  is currently offline 123star
Messages: 70
Registered: June 2010
Member
Hi Patrick,

The comment doesn't show in the model view.
The comment doesn't show in the editor.
The comment is like it never existed, so I think there's a problem in the way I create it.

I create the Comment executing a RecordingCommand in a TransactionalEditingDomain:

Command cmd = new RecordingCommand(domain) {
  protected void doExecute() {
    //owner is a Component
    Comment comment = owner.createOwnedComment();
    //edits the comment, e.g. apply stereotype to it
    //creates the view:
   ViewDescriptor viewDescriptor = new ViewDescriptor(
                new EObjectAdapter(comment), Node.class,
                                ((IHintedType) org.eclipse.papyrus.diagram.composite.providers.UMLElementTypes
                                        .getElementType(CommentEditPart.VISUAL_ID)).getSemanticHint(),
                                diagEpart.getDiagramPreferencesHint());

   viewDescriptor.setPersisted(true);

   CreateViewRequest req = new CreateViewRequest(viewDescriptor);
		
   Command comm = ownerPart.getCommand(req);
   comm.execute();
   
  }
}

domain.getCommandStack().execute(cmd);




I think it's not the best way to do it, but it's the only way I managed to get the visualization in the editor working( I've used it with ports).

Do you say that it's better if I use a command that create the element and the view at the same time?
Can you explain how?

Thank you again, 123star
Previous Topic:Confused about MDT Papyrus, Topcased and UML2
Next Topic:How can I add a UML interface to UML profile using Papyrus?
Goto Forum:
  


Current Time: Tue Sep 16 11:33:02 GMT 2014

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

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