Skip to main content



      Home
Home » Eclipse Projects » GEF » Removing a Connection from a Diagram
Removing a Connection from a Diagram [message #122457] Mon, 15 March 2004 10:36 Go to next message
Eclipse UserFriend
Originally posted by: phil.williams.toadmail.com

My editor allows a user to modify the number of connections on a
NodeEditPart.

When the user deletes a node that is already connected to another edit
part, I would like to also disconnect and delete the connection. I am
able to locate the corresponding editpart that belongs to the Link model
element, but I am not sure what to do with the ConnectionEditPart since
I can not find its parent to remove it.

So what I am left with is a connection drawn on the diagram that is no
longer selectable and can not be removed.

How do I go about removing the figure for the connection
(PolylineConnection) from the diagram?

Thanks,
Phil

FYI, this is a repost of an earlier post that was buried in a thread. :)
Re: Removing a Connection from a Diagram [message #122477 is a reply to message #122457] Mon, 15 March 2004 10:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You probably need to remove it from the Connection layer. The call will
probably look like this:
getLayer(CONNECTION_LAYER).remove(connectionFigure).

"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c34i9b$v7l$1@eclipse.org...
> My editor allows a user to modify the number of connections on a
> NodeEditPart.
>
> When the user deletes a node that is already connected to another edit
> part, I would like to also disconnect and delete the connection. I am
> able to locate the corresponding editpart that belongs to the Link model
> element, but I am not sure what to do with the ConnectionEditPart since
> I can not find its parent to remove it.
>
> So what I am left with is a connection drawn on the diagram that is no
> longer selectable and can not be removed.
>
> How do I go about removing the figure for the connection
> (PolylineConnection) from the diagram?
>
> Thanks,
> Phil
>
> FYI, this is a repost of an earlier post that was buried in a thread. :)
Re: Removing a Connection from a Diagram [message #122494 is a reply to message #122457] Mon, 15 March 2004 10:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: phil.williams.toadmail.com

Sorry for the wasted bandwidth. I just came across
removeTargetConnection() which does what I needed.

Phil Williams wrote:

> My editor allows a user to modify the number of connections on a
> NodeEditPart.
>
> When the user deletes a node that is already connected to another edit
> part, I would like to also disconnect and delete the connection. I am
> able to locate the corresponding editpart that belongs to the Link
> model element, but I am not sure what to do with the
> ConnectionEditPart since I can not find its parent to remove it.
>
> So what I am left with is a connection drawn on the diagram that is no
> longer selectable and can not be removed.
>
> How do I go about removing the figure for the connection
> (PolylineConnection) from the diagram?
>
> Thanks,
> Phil
>
> FYI, this is a repost of an earlier post that was buried in a thread. :)
Re: Removing a Connection from a Diagram [message #122541 is a reply to message #122457] Mon, 15 March 2004 15:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You should be removing the connection from your model. It is not any
different than if the user had selected the connection and pressed delete.
The commands should delete the connection, which should notify both source
and target editparts. Those editparts would then call
refreshXxxConnections(), which will get rid of the editpart.

You should only be calling removeTargetConnection directly if you are trying
to speed things up and bypass the normal rfreshTargetConnections call.

"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c34i9b$v7l$1@eclipse.org...
> My editor allows a user to modify the number of connections on a
> NodeEditPart.
>
> When the user deletes a node that is already connected to another edit
> part, I would like to also disconnect and delete the connection. I am
> able to locate the corresponding editpart that belongs to the Link model
> element, but I am not sure what to do with the ConnectionEditPart since
> I can not find its parent to remove it.
>
> So what I am left with is a connection drawn on the diagram that is no
> longer selectable and can not be removed.
>
> How do I go about removing the figure for the connection
> (PolylineConnection) from the diagram?
>
> Thanks,
> Phil
>
> FYI, this is a repost of an earlier post that was buried in a thread. :)
Re: Removing a Connection from a Diagram [message #122559 is a reply to message #122541] Mon, 15 March 2004 15:55 Go to previous message
Eclipse UserFriend
Originally posted by: phil.williams.toadmail.com

This is a multi-part message in MIME format.
--------------010906080404080405040407
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Thanks. I am removing it from the model and am now calling
refreshXXXConnections.

However, now it seems that the NodeFigure is not being redrawn
properly. I am calling repaint in the setPins() method on the figure as
you suggested earlier. However, the old pins are still present until
the node is moved in the diagram. The procedure for removing the pins
is as follows:

1) remove the connections from the model
2) update the connection list in the edit part
3) update the figure with the correct number of anchors
4) repaint the figure

I must be missing something (once again) but have not found the right
bits as of yet. Any clues are always appreciated.

Thanks again,
Phil


Randy Hudson wrote:

>You should be removing the connection from your model. It is not any
>different than if the user had selected the connection and pressed delete.
>The commands should delete the connection, which should notify both source
>and target editparts. Those editparts would then call
>refreshXxxConnections(), which will get rid of the editpart.
>
>You should only be calling removeTargetConnection directly if you are trying
>to speed things up and bypass the normal rfreshTargetConnections call.
>
>"Phil Williams" <phil.williams@toadmail.com> wrote in message
>news:c34i9b$v7l$1@eclipse.org...
>
>
>>My editor allows a user to modify the number of connections on a
>>NodeEditPart.
>>
>>When the user deletes a node that is already connected to another edit
>>part, I would like to also disconnect and delete the connection. I am
>>able to locate the corresponding editpart that belongs to the Link model
>>element, but I am not sure what to do with the ConnectionEditPart since
>>I can not find its parent to remove it.
>>
>>So what I am left with is a connection drawn on the diagram that is no
>>longer selectable and can not be removed.
>>
>>How do I go about removing the figure for the connection
>>(PolylineConnection) from the diagram?
>>
>>Thanks,
>>Phil
>>
>>FYI, this is a repost of an earlier post that was buried in a thread. :)
>>
>>
>
>
>
>

--------------010906080404080405040407
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body>
Thanks.&nbsp; I am removing it from the model and am now calling
refreshXXXConnections.<br>
<br>
However, now it seems that the NodeFigure is not being redrawn
properly.&nbsp; I am calling repaint in the setPins() method on the figure
as you suggested earlier.&nbsp; However, the old pins are still present
until the node is moved in the diagram.&nbsp; The procedure for removing the
pins is as follows:<br>
<br>
1) remove the connections from the model<br>
2) update the connection list in the edit part<br>
3) update the figure with the correct number of anchors<br>
4) repaint the figure<br>
<br>
I must be missing something (once again) but have not found the right
bits as of yet.&nbsp; Any clues are always appreciated.<br>
<br>
Thanks again,<br>
Phil<br>
<br>
<br>
Randy Hudson wrote:<br>
<blockquote cite="midc3539b$nbf$1@eclipse.org" type="cite">
<pre wrap="">You should be removing the connection from your model. It is not any
different than if the user had selected the connection and pressed delete.
The commands should delete the connection, which should notify both source
and target editparts. Those editparts would then call
refreshXxxConnections(), which will get rid of the editpart.

You should only be calling removeTargetConnection directly if you are trying
to speed things up and bypass the normal rfreshTargetConnections call.

"Phil Williams" <a class="moz-txt-link-rfc2396E" href="mailto:phil.williams@toadmail.com">&lt;phil.williams@toadmail.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:c34i9b$v7l$1@eclipse.org">news:c34i9b$v7l$1@eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">My editor allows a user to modify the number of connections on a
NodeEditPart.

When the user deletes a node that is already connected to another edit
part, I would like to also disconnect and delete the connection. I am
able to locate the corresponding editpart that belongs to the Link model
element, but I am not sure what to do with the ConnectionEditPart since
I can not find its parent to remove it.

So what I am left with is a connection drawn on the diagram that is no
longer selectable and can not be removed.

How do I go about removing the figure for the connection
(PolylineConnection) from the diagram?

Thanks,
Phil

FYI, this is a repost of an earlier post that was buried in a thread. :)
</pre>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
</body>
</html>

--------------010906080404080405040407--
Previous Topic:Connection suggestion
Next Topic:Design: widgets on the "canvas"
Goto Forum:
  


Current Time: Thu Jun 19 06:14:37 EDT 2025

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

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

Back to the top