Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Invalid Thread access using JFace wizards
Invalid Thread access using JFace wizards [message #168133] Tue, 09 December 2003 09:39 Go to next message
Eclipse UserFriend
Originally posted by: janestockdill.hotmail.com

This is a multi-part message in MIME format.

------=_NextPart_000_005F_01C3BE62.50687000
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I have written a wizard using JFace by looking at some example code.
When the wizard finishes it is not closing successfully - I imagine it =
has something to do with disposing of the wrong object.
Can someone please advise me on how to close the wizard successfully.
Thanks

Here is the error that is thrown and the code that starts the wizard:

org.eclipse.swt.SWTException: Invalid thread access

at org.eclipse.swt.SWT.error(SWT.java:2332)

at org.eclipse.swt.SWT.error(SWT.java:2262)

at org.eclipse.swt.widgets.Display.error(Display.java:607)

at org.eclipse.swt.widgets.Display.checkDevice(Display.java:460 )

at org.eclipse.swt.widgets.Display.update(Display.java:2298)

at org.eclipse.jface.window.Window.runEventLoop(Window.java:568 )

at org.eclipse.jface.window.Window.open(Window.java:542)

at =
com.ibm.mqe.mqeserver.wizard.RunCreateQMWizard.run(RunCreate QMWizard.java=
:40)

at =
com.ibm.mqe.mqeserver.wizard.RunCreateQMWizard.main(RunCreat eQMWizard.jav=
a:31)

Exception in thread "main"=20


The code I am using to start the wizard is:

public void run(){

Display d =3D new Display();

Shell s =3D new Shell(d);

SampleNewWizard wizard =3D new SampleNewWizard();

WizardDialog dialog =3D new WizardDialog(s, wizard);

dialog.open();=20


while (!s.isDisposed()) {


if (!d.readAndDispatch()){

d.sleep();

}=20

}d.dispose();

}

------=_NextPart_000_005F_01C3BE62.50687000
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>I have written a wizard using JFace by&nbsp;looking at&nbsp;some =
example=20
code.</DIV>
<DIV>When the wizard finishes it is not closing successfully - I imagine =
it has=20
something to do with disposing of the wrong object.</DIV>
<DIV>Can someone please advise me on how to close the wizard =
successfully.</DIV>
<DIV>Thanks</DIV>
<DIV>&nbsp;</DIV>
<DIV>Here is the error that is thrown and the code that starts the =
wizard:</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>
<P><FONT face=3DArial color=3D#ff0000 =
size=3D2>org.eclipse.swt.SWTException: Invalid=20
thread access</FONT></P>
<P><FONT face=3DArial color=3D#ff0000 size=3D2>at=20
org.eclipse.swt.SWT.error(SWT.java:2332)</FONT></P>
<P><FONT face=3DArial color=3D#ff0000 size=3D2>at=20
org.eclipse.swt.SWT.error(SWT.java:2262)</FONT></P>
<P><FONT face=3DArial color=3D#ff0000 size=3D2>at=20
org.eclipse.swt.widgets.Display.error(Display.java:607)</FONT ></P>
<P><FONT face=3DArial color=3D#ff0000 size=3D2>at=20
org.eclipse.swt.widgets.Display.checkDevice(Display.java:460 ) </FONT></P>
<P><FONT face=3DArial color=3D#ff0000 size=3D2>at=20
org.eclipse.swt.widgets.Display.update(Display.java:2298)</FONT ></P>
<P><FONT face=3DArial color=3D#ff0000 size=3D2>at=20
org.eclipse.jface.window.Window.runEventLoop(Window.java:568 ) </FONT></P>
<P><FONT face=3DArial color=3D#ff0000 size=3D2>at=20
org.eclipse.jface.window.Window.open(Window.java:542)</FONT ></P>
<P><FONT face=3DArial color=3D#ff0000 size=3D2>at=20
com.ibm.mqe.mqeserver.wizard.RunCreateQMWizard.run(RunCreate QMWizard.java=
:40)</FONT></P>
<P><FONT face=3DArial color=3D#ff0000 size=3D2>at=20
com.ibm.mqe.mqeserver.wizard.RunCreateQMWizard.main(RunCreat eQMWizard.jav=
a:31)</FONT></P>
<P><FONT face=3DArial color=3D#ff0000 size=3D2>Exception in thread =
"main"=20
</FONT></P></DIV>
<DIV>&nbsp;</DIV>
<DIV>The code I am using to start the wizard is:</DIV>
<DIV>&nbsp;</DIV>
<DIV><B><FONT color=3D#7f0055 size=3D2>
<P>public</B></FONT><FONT size=3D2> </FONT><B><FONT color=3D#7f0055=20
size=3D2>void</B></FONT><FONT size=3D2> run(){</P>
<P>Display d =3D </FONT><B><FONT color=3D#7f0055 =
size=3D2>new</B></FONT><FONT size=3D2>=20
Display();</P>
<P>Shell s =3D </FONT><B><FONT color=3D#7f0055 =
size=3D2>new</B></FONT><FONT size=3D2>=20
Shell(d);</P>
<P>SampleNewWizard wizard =3D </FONT><B><FONT color=3D#7f0055=20
size=3D2>new</B></FONT><FONT size=3D2> SampleNewWizard();</P>
<P>WizardDialog dialog =3D </FONT><B><FONT color=3D#7f0055=20
size=3D2>new</B></FONT><FONT size=3D2> WizardDialog(s, wizard);</P>
<P>dialog.open(); </FONT><FONT color=3D#3f7f5f size=3D2></P></FONT><FONT =
size=3D2>
<P></P>
<P></FONT><B><FONT color=3D#7f0055 size=3D2>while</B></FONT><FONT =
size=3D2>=20
(!s.isDisposed()) {</P>
<P></P>
<P></FONT><B><FONT color=3D#7f0055 size=3D2>if</B></FONT><FONT size=3D2> =

(!d.readAndDispatch()){</P>
<P>d.sleep();</P>
<P>} </P>
<P>}d.dispose();</P>
<P>}</P></FONT></DIV></BODY></HTML>

------=_NextPart_000_005F_01C3BE62.50687000--
Re: Invalid Thread access using JFace wizards [message #168277 is a reply to message #168133] Tue, 09 December 2003 14:29 Go to previous message
Eclipse UserFriend
Originally posted by: John_Arthorne.oti.com_

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/faq.html#uithread
--

Jane Stockdill wrote:
> I have written a wizard using JFace by looking at some example code.
> When the wizard finishes it is not closing successfully - I imagine it
> has something to do with disposing of the wrong object.
> Can someone please advise me on how to close the wizard successfully.
> Thanks
>
> Here is the error that is thrown and the code that starts the wizard:
>
>
> org.eclipse.swt.SWTException: Invalid thread access
>
> at org.eclipse.swt.SWT.error(SWT.java:2332)
>
> at org.eclipse.swt.SWT.error(SWT.java:2262)
>
> at org.eclipse.swt.widgets.Display.error(Display.java:607)
>
> at org.eclipse.swt.widgets.Display.checkDevice(Display.java:460 )
>
> at org.eclipse.swt.widgets.Display.update(Display.java:2298)
>
> at org.eclipse.jface.window.Window.runEventLoop(Window.java:568 )
>
> at org.eclipse.jface.window.Window.open(Window.java:542)
>
> at
> com.ibm.mqe.mqeserver.wizard.RunCreateQMWizard.run(RunCreate QMWizard.java:40)
>
> at
> com.ibm.mqe.mqeserver.wizard.RunCreateQMWizard.main(RunCreat eQMWizard.java:31)
>
> Exception in thread "main"
>
>
> The code I am using to start the wizard is:
>
>
> public void run(){
>
> Display d = new Display();
>
> Shell s = new Shell(d);
>
> SampleNewWizard wizard = new SampleNewWizard();
>
> WizardDialog dialog = new WizardDialog(s, wizard);
>
> dialog.open();
>
> while (!s.isDisposed()) {
>
> if (!d.readAndDispatch()){
>
> d.sleep();
>
> }
>
> }d.dispose();
>
> }
>
Previous Topic:eclipse 2.1. -> 3.0M5 ?
Next Topic:Threadworker for Swing, What for Eclipse?
Goto Forum:
  


Current Time: Thu Jul 17 08:28:27 EDT 2025

Powered by FUDForum. Page generated in 0.08141 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top