NullPointerException in AbstractEditPart.getRoot() [message #118524] |
Fri, 20 February 2004 13:24 |
Eclipse User |
|
|
|
Originally posted by: daniel_nospam.enigmatec.net
Hi all,
I'm getting the above when I create a child EditPart following instructions
elsewhere in this newsgroup. The trace is as follows:
java.lang.NullPointerException
at org.eclipse.gef.editparts.AbstractEditPart.getRoot
(AbstractEditPart.java:575)
at org.eclipse.gef.editparts.AbstractEditPart.getRoot
(AbstractEditPart.java:575)
at org.eclipse.gef.editparts.AbstractEditPart.getViewer
(AbstractEditPart.java:627)
at org.eclipse.gef.editparts.AbstractEditPart.registerModel
(AbstractEditPart.java:788)
at org.eclipse.gef.editparts.AbstractEditPart.register
(AbstractEditPart.java:768)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify
(AbstractEditPart.java:213)
at org.eclipse.gef.editparts.AbstractEditPart.addChild
(AbstractEditPart.java:182)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren
(AbstractEditPart.java:739)
at org.eclipse.gef.editparts.AbstractEditPart.refresh
(AbstractEditPart.java:691)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh
(AbstractGraphicalEditPart.java:519)
at org.eclipse.gef.editparts.AbstractConnectionEditPart.refresh
(AbstractConnectionEditPart.java:203)
at org.eclipse.gef.editparts.AbstractConnectionEditPart.setTarg et
(AbstractConnectionEditPart.java:271)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.removeNo tify
(AbstractGraphicalEditPart.java:671)
at org.eclipse.gef.editparts.AbstractEditPart.removeNotify
(AbstractEditPart.java:881)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.removeNo tify
(AbstractGraphicalEditPart.java:672)
at org.eclipse.gef.editparts.AbstractEditPart.removeChild
(AbstractEditPart.java:822)
at
org.eclipse.gef.editparts.FreeformGraphicalRootEditPart.setC ontents
(FreeformGraphicalRootEditPart.java:145)
at org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents
(AbstractEditPartViewer.java:350)
It seems to happen when getRoot() is called in the parent EditPart, after
being called by the child's getRoot() (hence the two getRoots above).
I'm adding children by overriding the getModelChildren() and createChild()
methods.
It's as if the child is being configured before its parent, which it is
dependent on for this configuration.
I've seen similar issues with removeNotify(). I tried this workaround
(overriding removeNotify and only calling once) but no joy.
Viewing the stack trace in the debugger, it seems that this occurs when a
connection is removed and the setTarget() method on
AbstractConnectionEditPart is called with null. But this ends up trying to
add a child in refreshChildren()!? I think I must be ommitting to do
something when I create the child.
Hope this may provoke some memories!
Dan
|
|
|
Re: NullPointerException in AbstractEditPart.getRoot() [message #118530 is a reply to message #118524] |
Fri, 20 February 2004 13:28 |
Eclipse User |
|
|
|
Originally posted by: daniel_nospam.enigmatec.net
Yes, I see now, it seems to be adding a new child when the
refreshChildren() method is called, because I've overriden
getModelChildren() and createChild(). Maybe I should put some test code
in here, or ovverride refreshChildren()...
Dan Gravell <daniel_nospam@enigmatec.net> wrote in
news:Xns949588F128E01danielnospamenigmate@204.138.98.10:
> Hi all,
>
> I'm getting the above when I create a child EditPart following
> instructions elsewhere in this newsgroup. The trace is as follows:
>
> java.lang.NullPointerException
> at org.eclipse.gef.editparts.AbstractEditPart.getRoot
> (AbstractEditPart.java:575)
> at org.eclipse.gef.editparts.AbstractEditPart.getRoot
> (AbstractEditPart.java:575)
> at org.eclipse.gef.editparts.AbstractEditPart.getViewer
> (AbstractEditPart.java:627)
> at org.eclipse.gef.editparts.AbstractEditPart.registerModel
> (AbstractEditPart.java:788)
> at org.eclipse.gef.editparts.AbstractEditPart.register
> (AbstractEditPart.java:768)
> at org.eclipse.gef.editparts.AbstractEditPart.addNotify
> (AbstractEditPart.java:213)
> at org.eclipse.gef.editparts.AbstractEditPart.addChild
> (AbstractEditPart.java:182)
> at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren
> (AbstractEditPart.java:739)
> at org.eclipse.gef.editparts.AbstractEditPart.refresh
> (AbstractEditPart.java:691)
> at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh
> (AbstractGraphicalEditPart.java:519)
> at org.eclipse.gef.editparts.AbstractConnectionEditPart.refresh
> (AbstractConnectionEditPart.java:203)
> at org.eclipse.gef.editparts.AbstractConnectionEditPart.setTarg et
> (AbstractConnectionEditPart.java:271)
> at
> org.eclipse.gef.editparts.AbstractGraphicalEditPart.removeNo tify
> (AbstractGraphicalEditPart.java:671)
> at org.eclipse.gef.editparts.AbstractEditPart.removeNotify
> (AbstractEditPart.java:881)
> at
> org.eclipse.gef.editparts.AbstractGraphicalEditPart.removeNo tify
> (AbstractGraphicalEditPart.java:672)
> at org.eclipse.gef.editparts.AbstractEditPart.removeChild
> (AbstractEditPart.java:822)
> at
> org.eclipse.gef.editparts.FreeformGraphicalRootEditPart.setC ontents
> (FreeformGraphicalRootEditPart.java:145)
> at org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents
> (AbstractEditPartViewer.java:350)
>
>
> It seems to happen when getRoot() is called in the parent EditPart,
> after being called by the child's getRoot() (hence the two getRoots
> above).
>
> I'm adding children by overriding the getModelChildren() and
> createChild() methods.
>
> It's as if the child is being configured before its parent, which it
> is dependent on for this configuration.
>
> I've seen similar issues with removeNotify(). I tried this workaround
> (overriding removeNotify and only calling once) but no joy.
>
> Viewing the stack trace in the debugger, it seems that this occurs
> when a connection is removed and the setTarget() method on
> AbstractConnectionEditPart is called with null. But this ends up
> trying to add a child in refreshChildren()!? I think I must be
> ommitting to do something when I create the child.
>
> Hope this may provoke some memories!
>
> Dan
>
|
|
|
Re: NullPointerException in AbstractEditPart.getRoot() [message #118850 is a reply to message #118530] |
Mon, 23 February 2004 10:55 |
Eclipse User |
|
|
|
Originally posted by: daniel_nospam.enigmatec.net
To anyone in a similar position - I fixed this by overriding getModel()
in my child EditPart and returned the string I used in getModelChildren()
to identify the EditPart. This meant the parent recognised it.
Cheers, Dan
Dan Gravell <daniel_nospam@enigmatec.net> wrote in
news:Xns9495898EF8CF1danielnospamenigmate@204.138.98.10:
> Yes, I see now, it seems to be adding a new child when the
> refreshChildren() method is called, because I've overriden
> getModelChildren() and createChild(). Maybe I should put some test code
> in here, or ovverride refreshChildren()...
>
> Dan Gravell <daniel_nospam@enigmatec.net> wrote in
> news:Xns949588F128E01danielnospamenigmate@204.138.98.10:
>
>> Hi all,
>>
>> I'm getting the above when I create a child EditPart following
>> instructions elsewhere in this newsgroup. The trace is as follows:
>>
>> java.lang.NullPointerException
>> at org.eclipse.gef.editparts.AbstractEditPart.getRoot
>> (AbstractEditPart.java:575)
>> at org.eclipse.gef.editparts.AbstractEditPart.getRoot
>> (AbstractEditPart.java:575)
>> at org.eclipse.gef.editparts.AbstractEditPart.getViewer
>> (AbstractEditPart.java:627)
>> at org.eclipse.gef.editparts.AbstractEditPart.registerModel
>> (AbstractEditPart.java:788)
>> at org.eclipse.gef.editparts.AbstractEditPart.register
>> (AbstractEditPart.java:768)
>> at org.eclipse.gef.editparts.AbstractEditPart.addNotify
>> (AbstractEditPart.java:213)
>> at org.eclipse.gef.editparts.AbstractEditPart.addChild
>> (AbstractEditPart.java:182)
>> at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren
>> (AbstractEditPart.java:739)
>> at org.eclipse.gef.editparts.AbstractEditPart.refresh
>> (AbstractEditPart.java:691)
>> at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh
>> (AbstractGraphicalEditPart.java:519)
>> at org.eclipse.gef.editparts.AbstractConnectionEditPart.refresh
>> (AbstractConnectionEditPart.java:203)
>> at org.eclipse.gef.editparts.AbstractConnectionEditPart.setTarg et
>> (AbstractConnectionEditPart.java:271)
>> at
>> org.eclipse.gef.editparts.AbstractGraphicalEditPart.removeNo tify
>> (AbstractGraphicalEditPart.java:671)
>> at org.eclipse.gef.editparts.AbstractEditPart.removeNotify
>> (AbstractEditPart.java:881)
>> at
>> org.eclipse.gef.editparts.AbstractGraphicalEditPart.removeNo tify
>> (AbstractGraphicalEditPart.java:672)
>> at org.eclipse.gef.editparts.AbstractEditPart.removeChild
>> (AbstractEditPart.java:822)
>> at
>> org.eclipse.gef.editparts.FreeformGraphicalRootEditPart.setC ontents
>> (FreeformGraphicalRootEditPart.java:145)
>> at org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents
>> (AbstractEditPartViewer.java:350)
>>
>>
>> It seems to happen when getRoot() is called in the parent EditPart,
>> after being called by the child's getRoot() (hence the two getRoots
>> above).
>>
>> I'm adding children by overriding the getModelChildren() and
>> createChild() methods.
>>
>> It's as if the child is being configured before its parent, which it
>> is dependent on for this configuration.
>>
>> I've seen similar issues with removeNotify(). I tried this workaround
>> (overriding removeNotify and only calling once) but no joy.
>>
>> Viewing the stack trace in the debugger, it seems that this occurs
>> when a connection is removed and the setTarget() method on
>> AbstractConnectionEditPart is called with null. But this ends up
>> trying to add a child in refreshChildren()!? I think I must be
>> ommitting to do something when I create the child.
>>
>> Hope this may provoke some memories!
>>
>> Dan
>>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.05351 seconds