Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Display a status file in a console-like view: SWT.ERROR_THREAD_INVALID_ACCESS
Display a status file in a console-like view: SWT.ERROR_THREAD_INVALID_ACCESS [message #304641] Tue, 13 June 2006 08:19 Go to next message
Eclipse UserFriend
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?

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
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 Go to previous message
Eclipse UserFriend
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
>
>
Previous Topic:Setting baseTOCS doesn't change TOC order
Next Topic:First column in TableViewer displaying problem in eclipse3.0.2
Goto Forum:
  


Current Time: Wed Nov 05 15:10:26 EST 2025

Powered by FUDForum. Page generated in 0.04357 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top