Community
Participate
Working Groups
Build Identifier: 20100617-1415 In my plug-in I have a dialog that runs a service. The service is implemented as an instance of a Job class that does the invocation over the net. When the job is finished and I want to go back to the UI thread to open a view and show the results, I get and ITA exception: org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:4083) at org.eclipse.swt.SWT.error(SWT.java:3998) at org.eclipse.swt.SWT.error(SWT.java:3969) at org.eclipse.swt.widgets.Widget.error(Widget.java:466) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:404) at org.eclipse.swt.widgets.Control.isVisible(Control.java:3173) at org.eclipse.ui.internal.WorkbenchPage.internalActivate(WorkbenchPage.java:602) at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:589) at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1096) at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1066) at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3822) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:52) at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3819) at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3795) at info.semanticsoftware.semassist.client.eclipse.handlers.FileSelectionHandler.openViews(FileSelectionHandler.java:111) at info.semanticsoftware.semassist.client.eclipse.handlers.EvaluationSession$1.done(EvaluationSession.java:87) at org.eclipse.core.internal.jobs.JobListeners$3.notify(JobListeners.java:39) at org.eclipse.core.internal.jobs.JobListeners.doNotify(JobListeners.java:112) at org.eclipse.core.internal.jobs.JobListeners.done(JobListeners.java:152) at org.eclipse.core.internal.jobs.JobManager.endJob(JobManager.java:646) at org.eclipse.core.internal.jobs.WorkerPool.endJob(WorkerPool.java:105) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:71) P.S I'm working on Linux OpenSuse 11.3 KDE 4. Reproducible: Always Steps to Reproduce: 1. Create a job instance trying to do an arbitrary task. 2. From inside the job run method or the class that invoked the job.schedule() try to do window.getActivePage().showView("THE_VIEW_ID"); ** window being the active workbench window
This is not a bug but a problem with your code. http://www.eclipse.org/swt/faq.php Please do not use Bugzilla for requesting assistance with the usage of Eclipse APIs, that is what the forums are for. http://www.eclipse.org/forums/
Use the UI thread. PW
(In reply to comment #2) > Use the UI thread. > PW Thanks for the super fast replies! The Job API documentation wasn't that clear about this issue, instead I found the solution on this page http://wiki.eclipse.org/FAQ_Why_do_I_get_an_invalid_thread_access_exception%3F