DZone Forums
Go Back   DZone Forums > Community > Tools & IDEs > Eclipse
Reload this Page UI Thread issues in SWT on eclipse 3.0
Notices
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Jan 2009
Default 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();
}
});
Reply With Quote
  (#2 (permalink)) Old
Moderator
 
Posts: 115
Thanks: 0
Thanked 9 Times in 9 Posts
Join Date: Jan 2008
Default 01-27-2009, 05:24 AM

I think part of the issue might be creating a new shell. Not sure, but maybe try Display.getCurrrent().getShell() instead?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deploying a new app with EMF jars using JWS issues jjabson Eclipse 0 12-19-2008 06:52 PM
issues with Action RoryCarson Eclipse 0 10-22-2008 03:03 PM
keep the main thread alive mitroiasi Java 0 03-13-2008 11:37 AM
Article page design issues & priorities rick Zones 1 02-08-2008 06:32 PM
Home page design issues & priorities rick Zones 30 02-02-2008 04:42 PM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com