Subject: !!!SWT widgets access exception!!!
From: Kojarski Sergei (kojarski@ccs.neu.edu)
Date: Sun Nov 24 2002 - 22:39:06 EST
Hi,
Ok, this means that OutputStreamMonitors are run in the separate thread,
so inside streamAppended we are in the other thread than Eclipse platform.
SWT doesn't allow direct access to SWT widgets from threads different from
the main (Eclipse) thread.
To find out how to deal with this problem take a look at:
http://dev.eclipse.org:8080/help/content/help:/org.eclipse.platform.doc.isv/guide/swt_threading.htm
It should help
(it's the same page as
Eclipse Documentation->Platform Plug-In Devel.Guide->Programmers
Guide->Standard Widget
Toolkit->Threading Issues)
Good luck,
Sergei.
On Sun, 24 Nov 2002, Wei Hua Chen wrote:
> Hi, Sergei. I implemented your suggesion and the
> StreamListener.streamAppended() method. But when I tried to update the
> view contents, I got an exception:
>
> org.eclipse.swt.SWTException: Invalid thread access
> at org.eclipse.swt.SWT.error(SWT.java:2119)
> at org.eclipse.swt.SWT.error(SWT.java:2051)
> at org.eclipse.swt.widgets.Widget.error(Widget.java:370)
> at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:301)
> at org.eclipse.swt.widgets.Table.getItemCount(Table.java:777)
> at
> org.eclipse.jface.viewers.TableViewer.indexForElement(TableViewer.java:313)
> at org.eclipse.jface.viewers.TableViewer.add(TableViewer.java:98)
> at
> edu.neu.ccs.com3205.lodChecker.views.ViewContentProvider.update(LoDCheckerView.java:250)
> at java.util.Observable.notifyObservers(Unknown Source)
> at
> edu.neu.ccs.com3205.lodChecker.views.LoDViolations.addViolation(LoDViolations.java:66)
> at
> edu.neu.ccs.com3205.lodChecker.views.StreamListener.streamAppended(LoDViolations.java:257)
> at
> org.eclipse.debug.internal.core.OutputStreamMonitor.fireStreamAppended(OutputStreamMonitor.java:96)
> at
> org.eclipse.debug.internal.core.OutputStreamMonitor.read(OutputStreamMonitor.java:127)
> at
> org.eclipse.debug.internal.core.OutputStreamMonitor.access$0(OutputStreamMonitor.java:115)
> a~t
> org.eclipse.debug.internal.core.OutputStreamMonitor$1.run(OutputStreamMonitor.java:166)
> at java.lang.Thread.run(Unknown Source)
>
> I don't understand what this exception means. Any idea what I did wrong?
> Thanks.
>
> :Wei.
>
>
This archive was generated by hypermail 2b28 : Sun Nov 24 2002 - 22:39:08 EST