User Tools

Site Tools


ui_access_from_job

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== Accessing UI from Background Job ====== In SWT (Eclipse) the UI can only be access and modified from the main Thread. Everything else results in an error: org.eclipse.swt.SWTException: Invalid thread access This can be fixed by synchronizing the with the main thread. In Eclipse e4 a ''UISynchronize'' instance can be injected like this: @Inject private UISynchronize sync; This allows us to run something from a background job accessing the UI. <sxh java> sync.asyncExec(new Runnable() { @Override public void run() { // your UI access here } }); </sxh> {{tag>e4 devel java}}

ui_access_from_job.1386014493.txt.gz · Last modified: 2013/12/02 20:01 by mihael