How to get onto GUI Event Thread from non UI thread... [message #123060] |
Thu, 26 February 2009 05:30 |
Eclipse User |
|
|
|
Originally posted by: michael.suwiryo.siemens.com
Hello,
In RCP application especially in Java multi-threaded application, it's very
common to execute some code on a different thread (a.k.a Thread Hop) and
then go back to UI Thread to update the UI.
Getting back to SWT Display Thread in RCP is straightforward because RCP is
only for single user and this can be done using Display.getDefault() call
which always return the right Display.
As for RAP, due to the nature of multi-user environment, there is no easy
way to go back to UI Event Thread from non UI Thread.
One possible solution is to keep passing Display reference all over the
place. But in some scenario, passing Display reference is probably not
possible.
Second possible solution is to store the Display object as part of the
HTTPSession with unique ID and then retrieve it back as necessary. The
problem with 2nd solution is that the RWT Utility class requires to be run
in UI Thread. So, this also does not work in non UI Thread case.
The desired solution here is to have true implementation of
Display.getDefault() in RAP which return the right Display based on current
user session. I understand why it may not be easy to implement this in RAP.
However, if supported, it would be easier to convert an RCP application to
RAP.
Besides the options I mention above, I was wondering if anyone has any
suggestion or pointer on how to solve this issue. Has anyone encountered
this problem?
Thanks for any pointers.
Regards,
Michael Suwiryo
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04161 seconds