Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Bug in drop comment?
Bug in drop comment? [message #640951] Tue, 23 November 2010 16:21 Go to next message
123star  is currently offline 123star Friend
Messages: 70
Registered: June 2010
Member
Hi,

I'm using this code to visualize a Comment created from code:

public static void dropObjectAt(EObject obj, EditPart epart, int x, int y){
		DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
		ArrayList<Object> objectList = new ArrayList<Object>();
		objectList.add(obj);
		dropObjectsRequest.setObjects(objectList);
		dropObjectsRequest.setLocation(new Point(x, y));
		org.eclipse.gef.commands.Command cmd = epart.getCommand(dropObjectsRequest);
		PapyrusMultiDiagramEditor editor = (PapyrusMultiDiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
		editor.getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
	}


The problem is that this Comment has one annotated element, and if I drop it manually the link is created, but if I use the dropObjectAt method it doesn't.
Debugging it turns out that the drop is processed in OldCommonDiagramDragAndDropEditPolicy.getDropConstraintComma nd:
the creation of the node Comment works, but the CommonDeferredCreateConnectionViewCommand doesn't find the edit part of the Comment.
So my question: should the parent of the Comment do a refresh to create an edit part for the Comment?
Why does it work when I drop the Comment manually?

If this is a bug I think it's related to another problem I'm having: in another post I asked how to modify the appearance of the Comment, Remi told me where to look, I found the code and tried to execute it in my code, but nothing happens.
I use the exact code that AppearanceForAppliedStereotypeComposite uses:
domain = EditorUtils.getTransactionalEditingDomain();

//appearance for the stereotype
domain.getCommandStack().execute(
		AppliedStereotypeHelper.getAddAppliedStereotypeCommand(domain, comment, stereoQualifiedName, presentationKind));
//appearance for the property

domain.getCommandStack().execute(
			AppliedStereotypeHelper.getAddAppliedStereotypePropertiesCommand(domain, comment, stereoQualifiedName+ "." + property.getName()));


The Comment remains unchanged and in this way the icons of the properties tree that appears in the appearance tab are not modified.
Is it possible to access directly to the instance of AppearanceForAppliedStereotypeComposite and simulate an user interaction (even if some methods are protected)?

Thanks in advance and sorry for the long post, 123star
Re: Bug in drop comment? [message #641182 is a reply to message #640951] Wed, 24 November 2010 13:44 Go to previous messageGo to next message
123star  is currently offline 123star Friend
Messages: 70
Registered: June 2010
Member
The appearance of the comment not showing was not a related bug, but an error in my code Smile

Remains the problem of the drop of the link
Re: Bug in drop comment? [message #641540 is a reply to message #641182] Thu, 25 November 2010 23:53 Go to previous messageGo to next message
Remi Schnekenburger is currently offline Remi SchnekenburgerFriend
Messages: 169
Registered: July 2009
Location: Palaiseau, France
Senior Member
Hi,

I will transfer this message to the person which used to develop this part of Papyrus. Hope you will have an answer soon Wink

Regards
Rémi


Remi Schnekenburger

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: Bug in drop comment? [message #641654 is a reply to message #641540] Fri, 26 November 2010 14:31 Go to previous messageGo to next message
Patrick Tessier is currently offline Patrick TessierFriend
Messages: 341
Registered: July 2009
Location: Paris Saclay, France
Senior Member
Hi 123Star,

First, I have dropped the comment into the diagram and the link has not be drawn. I have done that for the class diagram. And you which type is it your diagram?

For the class diagram this a bug, when I drop a comment I have also to display the link that is the annotated element.

Patrick
Re: Bug in drop comment? [message #641728 is a reply to message #641654] Sat, 27 November 2010 09:41 Go to previous messageGo to next message
123star  is currently offline 123star Friend
Messages: 70
Registered: June 2010
Member
Hi Patrick,

I drop the comment in a composite structure diagram with the above method dropObjectAt and the link is not created.
If I drop the same comment manually, then the link is created, so I think another way is used (which one? why they differ?)

So you're saying that the automatic drop of the link ( for the drop of a comment ) is not processed yet for the composite structure diagram?

Debugging I found out that a Command is created in OldCommonDiagramDragDropEditPolicy.getDropCommentCommand: there the link is not created because there is no edit part for the comment, so I thought that a refresh should be done on the containter of the comment for creating its edit part before the command for creating the link.

Thanks four your reply
Re: Bug in drop comment? [message #642285 is a reply to message #640951] Tue, 30 November 2010 16:57 Go to previous message
123star  is currently offline 123star Friend
Messages: 70
Registered: June 2010
Member
Quote:

Debugging I found out that a Command is created in OldCommonDiagramDragDropEditPolicy.getDropCommentCommand: there the link is not created because there is no edit part for the comment, so I thought that a refresh should be done on the containter of the comment for creating its edit part before the command for creating the link.



I think that the refresh of the container can't be done because the command that creates the comment is not processed yet.

I'm out of options.... here's the situation:
I use the method dropObjectAt(described above) to drop in a composite structure diagram a comment that has an annotated element( a port )
The comment is created but the link is not showing
If I drop the same comment manually the link is created

Why the manual drop works? What kind of command does it use?

Thanks in advance
Previous Topic:Block Interfaces with lollipop
Next Topic:Import model libraries and external profiles?
Goto Forum:
  


Current Time: Thu Apr 25 16:38:27 GMT 2024

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

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

Back to the top