Skip to main content



      Home
Home » Modeling » Graphiti » "Copy" bendpoints into another FreeFormConnection
"Copy" bendpoints into another FreeFormConnection [message #1319639] Mon, 28 April 2014 05:44 Go to next message
Eclipse UserFriend
Hey all,

I came across a behaviour I've never noticed before.

If I create a FreeFormConnection and add the bendpoints from another FreeFormConnection into it, the bendpoints from the first one are deleted afterwards.

AddConnectionContext addContext = new AddConnectionContext(start, end);
FreeFormConnection newCon = (FreeFormConnection) getFeatureProvider().addIfPossible(addContext);

FreeFormConnection tc = (FreeFormConnection) c;
System.out.println(tc.getBendpoints().size()); //returns 2
newCon.getBendpoints().addAll(tc.getBendpoints());
System.out.println(tc.getBendpoints().size()); //returns 0


Am I doing something wrong?

[Updated on: Mon, 28 April 2014 05:46] by Moderator

Re: "Copy" bendpoints into another FreeFormConnection [message #1327771 is a reply to message #1319639] Fri, 02 May 2014 06:28 Go to previous messageGo to next message
Eclipse UserFriend
This typically happens when copying references to contained objects.
Since en EObject can only be contained in one container, such a copy
becomes a move. Use EcoreUtil.copy to create a deep copy and add the
copies instead.

On 28.04.14 11:44, Soeren M wrote:
> Hey all,
>
> I came across a behaviour I've never noticed before.
>
> If I create a FreeFormConnection and add the bendpoints from another
> FreeFormConnection into it, the bendpoints from the first one are
> deleted afterwards.
>
>
> AddConnectionContext addContext = new AddConnectionContext(start, end);
> FreeFormConnection newCon = (FreeFormConnection)
> getFeatureProvider().addIfPossible(addContext);
>
> FreeFormConnection tc = (FreeFormConnection) c;
> System.out.println(tc.getBendpoints().size());
> newCon.getBendpoints().addAll(tc.getBendpoints());
> System.out.println(tc.getBendpoints().size());
>
>
> Am I doing something wrong?
Re: "Copy" bendpoints into another FreeFormConnection [message #1327941 is a reply to message #1327771] Fri, 02 May 2014 08:20 Go to previous message
Eclipse UserFriend
Hi Hallvard, thank you very much for the explanation Smile
Previous Topic:Displaying Images
Next Topic:Double-click palette entry
Goto Forum:
  


Current Time: Wed Jul 23 02:25:25 EDT 2025

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

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

Back to the top