Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How can i determine whether the UI thread has been created?
How can i determine whether the UI thread has been created? [message #465372] Sun, 11 December 2005 21:30 Go to next message
Eclipse UserFriend
Originally posted by: wudong.liu.gmail.com

If the UI thread is created and running, i want to using the asyncExec()
to execute some code in it. If it's not, i have to create a new thread to
create the display.
but the problem is, how can i determine whether the UI thread is created
or not?
Re: How can i determine whether the UI thread has been created? [message #465374 is a reply to message #465372] Mon, 12 December 2005 00:54 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Wudong Liu wrote:

> If the UI thread is created and running, i want to using the asyncExec()
> to execute some code in it. If it's not, i have to create a new thread to
> create the display.
> but the problem is, how can i determine whether the UI thread is created
> or not?
try grab active shell or window and if it isn't null you are in UI thread
for example,

if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
// UI thread
}
Re: How can i determine whether the UI thread has been created? [message #465469 is a reply to message #465372] Wed, 14 December 2005 15:19 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
If you know what threads exist (e.g. Thread.enumerate()), you could loop
over the threads and use Display.findDisplay(Thread) to determine if there
is a display for any of the threads.

"Wudong Liu" <wudong.liu@gmail.com> wrote in message
news:e25ffa023905baec8fbd7e1d98f80a6b$1@www.eclipse.org...
> If the UI thread is created and running, i want to using the asyncExec()
> to execute some code in it. If it's not, i have to create a new thread to
> create the display.
> but the problem is, how can i determine whether the UI thread is created
> or not?
>
Previous Topic:how to force ktable model to redraw
Next Topic:Potential bug in TableViewer with associated VIRTUAL table
Goto Forum:
  


Current Time: Tue Apr 16 07:24:00 GMT 2024

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

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

Back to the top