I have java project, which lanches two SWT dialogs, for some input. Sometime I got below exception while launch dialog. I googled it but found only display init issue. But i got shell init issue. Can some one help me on this.
Sample Code
public static Display getDisplay ()
{
Display display = Display.getCurrent ();
// may be null if outside the UI thread
if (display == null)
display = Display.getDefault ();
return display;
}
Display display = getDisplay();
Shell shell = new Shell(display);
Excepton
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4441)
at org.eclipse.swt.SWT.error(SWT.java:4356)
at org.eclipse.swt.SWT.error(SWT.java:4327)
at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:283)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:274)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:224)
at gui.lms.analysisRequestGUI.GenericDialog.showDialog(Unknown Source)
at gui.teamcenter.gui.actions.PublishAction$1.execute(Unknown Source)
at base_gui.basegui.util.WorkerThread.run(Unknown Source)