Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Reordering children + ShortestPathConnectionRouter = trouble
Reordering children + ShortestPathConnectionRouter = trouble [message #184792] Thu, 16 June 2005 22:36 Go to next message
Leonid Mokrushin is currently offline Leonid MokrushinFriend
Messages: 25
Registered: July 2009
Junior Member
My GEF editor has nested containers, each with its own set of layers and a
router. Let's say I have the following edit part tree:

Container1
--- Container2
------ Child1
------ Container3

I delete Container2 from Container1 using a compound delete command which
deletes Child1, then Container 3 and finally Container2.
After deletion of Child1, there is a refresh which causes reordering of
Container3 so that it changes its index in Container2 from 1 to 0
(AbstractGraphicalEditPart#reorderChild). This calls
AbstractEditPart#removeChildVisual followed by
AbstractEditPart#addChildVisual which messes something in the
ShortestPathConnectionRouter installed in Container3 and later I get:

java.lang.NullPointerException:
at
org.eclipse.draw2d.ShortestPathConnectionRouter.remove(Short estPathConnectionRouter.java:170)
at org.eclipse.draw2d.AutomaticRouter.remove(AutomaticRouter.ja va:135)
at
org.eclipse.draw2d.PolylineConnection.setConnectionRouter(Po lylineConnection.java:198)
at org.eclipse.draw2d.ConnectionLayer.remove(ConnectionLayer.ja va:75)
.........

I have fixed the problem by enforcing Child1 to go always after all
Container3 so that there is no reordering, but in general it feels unsafe.

Ideas?
Re: Reordering children + ShortestPathConnectionRouter = trouble [message #184882 is a reply to message #184792] Sun, 19 June 2005 06:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

There is one shortest path router for all connections, right? Why do you
delete the children of the container being deleted?

It sounds like a possible bug but one which the logic example doesn't show
because the delete is simpler. Which release are you using?

"Leonid Mokrushin" <leom@it.uu.se> wrote in message
news:d8susv$3k5$1@news.eclipse.org...
> My GEF editor has nested containers, each with its own set of layers and a
> router. Let's say I have the following edit part tree:
>
> Container1
> --- Container2
> ------ Child1
> ------ Container3
>
> I delete Container2 from Container1 using a compound delete command which
> deletes Child1, then Container 3 and finally Container2.
> After deletion of Child1, there is a refresh which causes reordering of
> Container3 so that it changes its index in Container2 from 1 to 0
> (AbstractGraphicalEditPart#reorderChild). This calls
> AbstractEditPart#removeChildVisual followed by
> AbstractEditPart#addChildVisual which messes something in the
> ShortestPathConnectionRouter installed in Container3 and later I get:
>
> java.lang.NullPointerException:
> at
> org.eclipse.draw2d.ShortestPathConnectionRouter.remove(Short estPathConnectionRouter.java:170)
> at org.eclipse.draw2d.AutomaticRouter.remove(AutomaticRouter.ja va:135)
> at
> org.eclipse.draw2d.PolylineConnection.setConnectionRouter(Po lylineConnection.java:198)
> at org.eclipse.draw2d.ConnectionLayer.remove(ConnectionLayer.ja va:75)
> ........
>
> I have fixed the problem by enforcing Child1 to go always after all
> Container3 so that there is no reordering, but in general it feels unsafe.
>
> Ideas?
>
>
Re: Reordering children + ShortestPathConnectionRouter = trouble [message #185773 is a reply to message #184882] Thu, 30 June 2005 01:05 Go to previous message
Leonid Mokrushin is currently offline Leonid MokrushinFriend
Messages: 25
Registered: July 2009
Junior Member
> There is one shortest path router for all connections, right?

No, I meant every container has it's own connection layer and it's own
router (Fan+ShortestPath). They are created in the container's figure
initialization code. No connection figure goes out of its container figure
boundary.

> Why do you delete the children of the container being deleted?

I do not handle all the container children in the delete command, only those
children that represent ports of my containers (circles drawn on top of the
container figure borders). Besides port figures are not contained by the
container figure primary layer they are also nodes that handle all the
container's (i.e. their parent's) connections, so I need special add/delete
code. Contrary to the logic example in my editor one can add/remove ports
from the palette as well as move them along the edges of the container.

> It sounds like a possible bug but one which the logic example doesn't show
> because the delete is simpler. Which release are you using?

I've tried the latest one from 2005-06-28 and the problem is still there.

Actually I have experienced similar kind of problem in another context
earlier (however, maybe it's a completely different issue :).
A root edit part with the flow layout had two children - containers with
their own connection layers and routers like this:

-Root (Flow layout)
--- Container1
------- Child \ these two are linked
------- Child / with the connection routed by Container1 router
--- Container2
------- Child \ these two are linked
------- Child / with the connection routed by Container2 router

The problem occurred when one reorders Container1 and Container2 by dragging
e.g. Container2 and dropping it in front of the Container1. The links
between children were losing their routing constraints. The fix was to put
additional setRoutingConstraints() call to the connection figure addNofify()
methods. One would expect Container internals to stay intact during reorder
but investigation has shown that the figures are recreated every time such
drag&drop happens.

/Leo


>
> "Leonid Mokrushin" <leom@it.uu.se> wrote in message
> news:d8susv$3k5$1@news.eclipse.org...
>> My GEF editor has nested containers, each with its own set of layers and
>> a router. Let's say I have the following edit part tree:
>>
>> Container1
>> --- Container2
>> ------ Child1
>> ------ Container3
>>
>> I delete Container2 from Container1 using a compound delete command which
>> deletes Child1, then Container 3 and finally Container2.
>> After deletion of Child1, there is a refresh which causes reordering of
>> Container3 so that it changes its index in Container2 from 1 to 0
>> (AbstractGraphicalEditPart#reorderChild). This calls
>> AbstractEditPart#removeChildVisual followed by
>> AbstractEditPart#addChildVisual which messes something in the
>> ShortestPathConnectionRouter installed in Container3 and later I get:
>>
>> java.lang.NullPointerException:
>> at
>> org.eclipse.draw2d.ShortestPathConnectionRouter.remove(Short estPathConnectionRouter.java:170)
>> at org.eclipse.draw2d.AutomaticRouter.remove(AutomaticRouter.ja va:135)
>> at
>> org.eclipse.draw2d.PolylineConnection.setConnectionRouter(Po lylineConnection.java:198)
>> at org.eclipse.draw2d.ConnectionLayer.remove(ConnectionLayer.ja va:75)
>> ........
>>
>> I have fixed the problem by enforcing Child1 to go always after all
>> Container3 so that there is no reordering, but in general it feels
>> unsafe.
>>
>> Ideas?
>>
>>
>
>
Previous Topic:How can I prevent escape from closing display view in run/debug
Next Topic:Auto Layout on Subgraphs
Goto Forum:
  


Current Time: Tue Dec 03 08:53:59 GMT 2024

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

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

Back to the top