[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: None-UI thread model updates and Display.getCurrent() returning null.

Randy Hudson wrote:
Exactly what I do. In my property listeners I create a runnable to handle the call to refreshVisuals(). Actually my runnable is a class member and not a local variable.

I pass my runnable into a display I get by calling

getViewer().getControl().getDisplay();

I use syncExec

CL


Anytime you do something like that you should catch any NPEs. It is possible that the editor gets closed, or the editpart is removed from the viewer, etc. after the background event has been dispatched but before your code runs.



Ahh, good thing I use syncExec then right? Closing the editor requires the GUI thread IIRC, so syncExec should ensure my job is performed first?


Bah, but so I dont have to fight through all the possibilities ill catch the NPE. Thanks for the tip.


CL