Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Disabling IAction from non-UI thread.
Disabling IAction from non-UI thread. [message #1242995] Mon, 10 February 2014 11:13 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 566
Registered: July 2009
Senior Member
Hi all,

Some part of my code that updates UI runs in ExecutorService, i.e:

ExecutorService executor = new ThreadPoolExecutor(1, 1, 1000, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(1000));

Runnable task = new Runnable()
	public void run()
		IAction action = ...


The code above throws IllegalStateException since it's not running in UI thread but to do so I have to obtain instance of Display using Display.getCurrent() or Display.getDefault() which keeps returning null.

Any ideas ?

Any help would be greatly appreciated.

Thanks & Regards,

Re: Disabling IAction from non-UI thread. [message #1243057 is a reply to message #1242995] Mon, 10 February 2014 13:08 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Setya,

there are many users in parallel, and so there are many displays. Code
that's running in a non-UI thread is not bound to any particular
display, so Display.getCurrent() will return null. You have to memorize
the display that you want to access from a background thread.


Ralf Sternberg

Twitter: @EclipseRAP

Professional services for RAP and RCP?
Previous Topic:Installation of dropdown2.2 (incubation) fails
Next Topic:Web Workers in RAP
Goto Forum:

Current Time: Wed Jun 20 09:53:10 GMT 2018

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

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

Back to the top