Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Thread problem
Thread problem [message #149797] Thu, 02 September 2004 20:28 Go to next message
Eclipse UserFriend
Originally posted by: thomas.p.larsson.spray.se

Hello all,

I have some models in my GEF app that each implement Runnable. I have an
Menu action called run which creates a Thread for each model and starts
them.
At one point one model which has a label as its EditPart figure calls
firePropertyChange (I want the Labels text to be updated) but then I get
this error:
java.lang.NullPointerException
at
org.eclipse.draw2d.DeferredUpdateManager.queueWork(DeferredU pdateManager.java:146)
at
org.eclipse.draw2d.DeferredUpdateManager.addInvalidFigure(De ferredUpdateManager.java:96)
at org.eclipse.draw2d.Figure.revalidate(Figure.java:1212)
at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
at org.eclipse.draw2d.Label.setText(Label.java:594)
at editparts.LabelEditPart.refreshVisuals(LabelEditPart.java:48 )
at editparts.MyNodeEditPart.propertyChange(MyNodeEditPart.java: 67)
at
java.beans.PropertyChangeSupport.firePropertyChange(Property ChangeSupport.java:252)
at model.AbstractModel.firePropertyChange(AbstractModel.java:80 )
at model.LabelModel.run(LabelModel.java:50)
at java.lang.Thread.run(Thread.java:534)

I believe the error is because the method Display.findDisplay which
returns the display for which the current thread is the user interface
thread returns null, since the calling thread is one of my newly creates
ones. Does anyone have any idea how to get around this?

Thanks
-Thomas
Re: Thread problem [message #149807 is a reply to message #149797] Thu, 02 September 2004 20:53 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Figure's cannot be accessed from multiple threads. They are not
thread-safe. Use syncExec or asyncExec

"Thomas" <thomas.p.larsson@spray.se> wrote in message
news:ch7vp1$32q$1@eclipse.org...
>
> Hello all,
>
> I have some models in my GEF app that each implement Runnable. I have an
> Menu action called run which creates a Thread for each model and starts
> them.
> At one point one model which has a label as its EditPart figure calls
> firePropertyChange (I want the Labels text to be updated) but then I get
> this error:
> java.lang.NullPointerException
> at
>
org.eclipse.draw2d.DeferredUpdateManager.queueWork(DeferredU pdateManager.jav
a:146)
> at
>
org.eclipse.draw2d.DeferredUpdateManager.addInvalidFigure(De ferredUpdateMana
ger.java:96)
> at org.eclipse.draw2d.Figure.revalidate(Figure.java:1212)
> at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
> at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
> at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
> at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
> at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
> at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
> at org.eclipse.draw2d.Figure.revalidate(Figure.java:1214)
> at org.eclipse.draw2d.Label.setText(Label.java:594)
> at editparts.LabelEditPart.refreshVisuals(LabelEditPart.java:48 )
> at editparts.MyNodeEditPart.propertyChange(MyNodeEditPart.java: 67)
> at
>
java.beans.PropertyChangeSupport.firePropertyChange(Property ChangeSupport.ja
va:252)
> at model.AbstractModel.firePropertyChange(AbstractModel.java:80 )
> at model.LabelModel.run(LabelModel.java:50)
> at java.lang.Thread.run(Thread.java:534)
>
> I believe the error is because the method Display.findDisplay which
> returns the display for which the current thread is the user interface
> thread returns null, since the calling thread is one of my newly creates
> ones. Does anyone have any idea how to get around this?
>
> Thanks
> -Thomas
>
Previous Topic:configuring palette views
Next Topic:coordinate system/documentation
Goto Forum:
  


Current Time: Sat Apr 27 02:32:42 GMT 2024

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

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

Back to the top