| Display a status file in a console-like view: SWT.ERROR_THREAD_INVALID_ACCESS [message #304641] |
Tue, 13 June 2006 08:19  |
Eclipse User |
|
|
|
Originally posted by: wolfgang.moestl.softwareag.com
Hi All,
What would bet the recommended way to watch for changes in a file and
print the new lines to the console view?
Im writing a Plugin for an external program, which writes its progress
and status information to files. The external program can run for quite a
while.
Every time one of the status files is updated I want the new line(s) to be
displayed either in the console or in a self-written console-like view.
Currently Im checking the status file using a separated thread reading
the file and updating the model of the self-written console-style view.
Unfortunately this seems not to be possible, because SWT throws a
SWT.ERROR_THREAD_INVALID_ACCESS exception in the
org.eclipse.swt.widgets.Widget checkWidget () method because my file
listening thread is causing a redraw in order to tell the widget to
display the updated model:
8<=============================================
if (display.thread != Thread.currentThread ()) error
(SWT.ERROR_THREAD_INVALID_ACCESS);
==============================================>8
So this approach does not look promising.
Do I miss something here or is there a better way to display the status
file information?
Thanks a lot!
Best regards,
Wolf
|
|
|
| Re: Display a status file in a console-like view: SWT.ERROR_THREAD_INVALID_ACCESS [message #304642 is a reply to message #304641] |
Tue, 13 June 2006 08:30  |
Eclipse User |
|
|
|
Yes you need to run your code which updates any SWT-Widget in
Display.syncExec( new Runnable() );-block
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet7.j ava
Tom
Wolfgang schrieb:
> Hi All,
>
> What would bet the recommended way to watch for changes in a file and
> print the new lines to the console view?
>
> I�m writing a Plugin for an external program, which writes its progress
> and status information to files. The external program can run for quite
> a while.
> Every time one of the status files is updated I want the new line(s) to
> be displayed either in the console or in a self-written console-like view.
>
> Currently I�m checking the status file using a separated thread reading
> the file and updating the model of the self-written console-style view.
> Unfortunately this seems not to be possible, because SWT throws a
> SWT.ERROR_THREAD_INVALID_ACCESS exception in the
> org.eclipse.swt.widgets.Widget checkWidget () method because my file
> listening thread is causing a redraw in order to tell the widget to
> display the updated model:
> 8<=============================================
> if (display.thread != Thread.currentThread ()) error
> (SWT.ERROR_THREAD_INVALID_ACCESS);
> ==============================================>8
>
> So this approach does not look promising.
>
> Do I miss something here or is there a better way to display the status
> file information?
>
> Thanks a lot!
>
> Best regards,
> Wolf
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03070 seconds