problem with updating TableTreeViewer using IResourceChangeListener [message #153879] |
Mon, 12 April 2004 21:14  |
Eclipse User |
|
|
|
Originally posted by: lshan.imail.eecs.berkeley.edu
Hi all eclipse masters,
I have TableTreeViewer to display a tree to reflect the stuff on local file
system. I want that view to be automatically updated when a there is a
change in the resources. Thus, i used IResourceChangeListener. Inside
IResourceChangeListener.resourceChanged(), i remove all the TableTreeItem in
that TableTreeViewer and then search for the new ones, then create
TableTreeItems for them.
The problem occurs when i try to remove all TableTreeItems. I got an
SWTException: "Invalid Thread Access". I found out TableTreeItem is only
allowed to be modified by the thread that created it, but the thread that
invokes IResourceChangeListener.resourceChanged() is not that creating
thread. Therefore, all manipulations inside
IResourceChangeListener.resourceChanged() are disallowed.
How can i solve this problem?? Am i taking the wrong approach?? There must
be a way to solve it.
Thank you very much for all your helps.
Lexin
|
|
|
Re: problem with updating TableTreeViewer using IResourceChangeListener [message #155017 is a reply to message #153879] |
Mon, 19 April 2004 18:03  |
Eclipse User |
|
|
|
Like in Swing in SWT is just one thread listening for user input and
doing all the (re-)drawing. Use Display.(a)syncExec() to execute your
code. You usually obtain that by accessing the current shell.
Sorry, have no Eclipse handy to be more detailed/accurate.
Lexin Shan wrote:
> Hi all eclipse masters,
>
> I have TableTreeViewer to display a tree to reflect the stuff on local file
> system. I want that view to be automatically updated when a there is a
> change in the resources. Thus, i used IResourceChangeListener. Inside
> IResourceChangeListener.resourceChanged(), i remove all the TableTreeItem in
> that TableTreeViewer and then search for the new ones, then create
> TableTreeItems for them.
>
> The problem occurs when i try to remove all TableTreeItems. I got an
> SWTException: "Invalid Thread Access". I found out TableTreeItem is only
> allowed to be modified by the thread that created it, but the thread that
> invokes IResourceChangeListener.resourceChanged() is not that creating
> thread. Therefore, all manipulations inside
> IResourceChangeListener.resourceChanged() are disallowed.
>
> How can i solve this problem?? Am i taking the wrong approach?? There must
> be a way to solve it.
>
> Thank you very much for all your helps.
>
> Lexin
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03188 seconds