[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Finding the right parent for a SWT Shell
|
Hi -
I am developing some code in Eclipse. I want to open a window and display
some data to the user. My problem is -- how do I determine the right parent
for the window? Every SWT control needs a parent to be specified to its
constructor, and I do not have a handle to the graphic environment of
Eclipse at the point I want to display the data.
According to what I read about SWT, one cannot just create a new Display
object -- there is supposed to only be one in effect at a time. So, I must
use the existing Display as the parent of the Shell that I want to open.
Display.getCurrent() returns null, which means that my code is not running
in the ui thread. That is probably true.
Display.getDefault() returns a Display object, but when trying to create a
Shell with it as parent, the code throws a SWTException, Invalid thread
access, which means the current thread is not the thread that created the
object.
Any advice would be very much appreciated.
-- Mike