I am building an application in swt, I also have a thread running which polls the database for any changes (made directly to the db or by another application).
I am able to pick up the changes but I now need to tell my interface to refresh, I tried calling the objects refresh method (that I made) directly from the thread but I get an SWTException "Invalid Thread Access".
Is there a way to create my own event inside the thread which can then be manually fired upon finding a change on the database, which is then picked up by the class that needs to be refreshed.
I have looked at SWT events but I can only seem to find ones which are attached to widgets and can only be fired through the widget itself…
Thanks!
You need to update the user interface from the user-interface thread.
One way to do that is to use one of these methods on the org.eclipse.swt.widgets.Display class:
or: