[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.

Steve Jones wrote:
Hi,

I have a multi-page editor based on org.eclipse.ui.forms.editor.FormEditor
that has a mix of GEF based pages and source/text pages that use
AbstractTextEditor.

GEF pages update the model and reflect changes as just fine but I'm getting
null pointer exceptions, in GEF, when I update the model from text pages.

All my model updates use background threads that ultimately call
AbstractEditPart.refreshVisuals(). This fails, I think, because
org.eclipse.swt.widgets.Display.getCurrent() returns null when called from
a none-UI thread.

Whats the best way of dealing with this?

Steve.

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