Thread problem with JFace Tableviewer

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Thread problem with JFace Tableviewer

Postby twittemb » Wed Dec 03, 2003 12:53 pm

Hello,

here is my problem :

I'm trying to refresh a Tableviewer inside a run thread Method but it throws a SWT exception.

here is the global scheme :

An applicationWindow holds a table. I've got a process which is actually a thread. And in the Run method of this Thread i refresh the tableviewer content. But that throws an Exception.

Do someone have already face this problem an is there a solution ?

Thank you.
twittemb
 
Posts: 2
Joined: Wed Dec 03, 2003 12:47 pm

Postby admin » Wed Dec 03, 2003 8:24 pm

First: you did not published exception.
Second: SWT controls (and JFace too) can be accessed only from main thread. So, look at methods Display.syncExec() and Display.asyncExec() and use one of them in your thread every time when you want call refresh. But keep in mind that you should use them only when you realy need this, don't call Thread.sleep() or any other method that block execution on long period.

I believe that this is described in many SWT tutorials and articles.
admin
Moderator
 
Posts: 166
Joined: Thu Jul 24, 2003 12:25 am

Postby twittemb » Thu Dec 04, 2003 4:18 am

Thanks for your answer ...

i've tried your solution ...

but that freezes the main window ...

I can't find a good solution on the Internet !!!

Are you aware of this problem ???

thanks !
twittemb
 
Posts: 2
Joined: Wed Dec 03, 2003 12:47 pm

Postby Eric Clayberg » Thu Dec 04, 2003 5:01 am

twittemb wrote:i've tried your solution ...
but that freezes the main window ...
I can't find a good solution on the Internet !!!
Are you aware of this problem ???

Since you haven't yet stated what exception you encountered, that would be hard to say. When you say you "tried" our solution, what do you mean? You should post some sample code illustrating what you are trying to do.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest