|
UI Thread issues in SWT on eclipse 3.0 -
01-21-2009, 12:44 AM
Hi,
I am writing a plugin which looks up the update site and installs or updates the features and pops up a message box asking the user to start the workbench. This works fine with Eclipse 3.4, but when I'm doing this for older versions like eclipse 3.0.1, I'm running into UI thread issues. Now the new plugins are installed, but when it is trying to pop up the message, it shows the following exceptions
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:2691)
at org.eclipse.swt.SWT.error(SWT.java:2616)
at org.eclipse.swt.SWT.error(SWT.java:2587)
at org.eclipse.swt.widgets.Display.checkDisplay(Displ ay.java:568)
at org.eclipse.swt.widgets.Display.create(Display.jav a:629)
at org.eclipse.swt.graphics.Device.<init>(Device.java :99)
at org.eclipse.swt.widgets.Display.<init>(Display.jav a:355)
at org.eclipse.swt.widgets.Display.<init>(Display.jav a:351)
at org.eclipse.ui.internal.Workbench.createDisplay(Wo rkbench.java:278)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI .java:153)
at standaloneupdateapp.AutoUpdateManager$1.run(AutoUp dateManager.java:307)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Sync hronizer.java:135)
at org.eclipse.swt.widgets.Display.syncExec(Display.j ava:3096)
at standaloneupdateapp.AutoUpdateManager.performAutoU pdate(AutoUpdateManager.java:304)
at standaloneupdateapp.AutoUpdateManager.run(AutoUpda teManager.java:80)
at org.eclipse.core.internal.runtime.PlatformActivato r$1.run(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.ru n(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.ru n(EclipseStarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at org.eclipse.core.launcher.Main.basicRun(Main.java: 185)
at org.eclipse.core.launcher.Main.run(Main.java:704)
at org.eclipse.core.launcher.Main.main(Main.java:688)
and the code at AutoupdateManager.java:307 is
Display.getDefault().asyncExec(new Runnable() {
public void run() {
Shell shell = new Shell(PlatformUI.createDisplay());
String message = "New Plug-ins have been installed. \n Restart of " + PRODUCT_NAME + " is recommended.";
MessageDialog
.openInformation(shell, "C2 Rational Updates", message);
shell.forceActive();
}
});
|