|
Re: How to launch a dialog in syncExec? [message #454111 is a reply to message #454108] |
Mon, 18 April 2005 03:24 |
Eclipse User |
|
|
|
Originally posted by: doug-list.threepenny.net
I would guess the problem is that your message pumping code
(display.readAndDispatch()) is not getting called now. That would cause
the dialog to appear but then the app would lock up.
Perhaps switching to syncExec means that because you're now waiting for
that call to complete you're not reaching the code that pumps the messages.
Doug
wangwei wrote:
> Hi, all!
>
> I know that we can open a dialog in Display.asyncExec().
>
> But now I need to keep most of my code in a non-UI thread,
> and just insert a confirm dialog in the middle.
> So I think I should use syncExec instead of asyncExec,
> while I failed to open any dialog in syncExec().
> I can see the dialog, but any input is blocked.
>
> Any advice? thanks in advance.
>
> ragards, wangwei
>
>
|
|
|
|
|
Re: How to launch a dialog in syncExec? [message #454226 is a reply to message #454202] |
Tue, 19 April 2005 13:35 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
You should have block on open(true) and not have the read/dispatch loop.
If you set block on open true it will run the dispatch loop for you.
In other words, just:
>
> final Display display = Display.getDefault();
> display.asyncExec(new Runnable() {
> public void run() {
> XYChartDialog dlg = new XYChartDialog(null, xy);
> dlg.setBlockOnOpen(false);
> dlg.open();
> }
> });
>
should be sufficient.
But why are you creating a Shell? The jface.Window class doesn't require
to have a shell passed in on the constructor. A null will do. You only
need a shell if you want your dialog to be in front of another shell AND
have that other shell disabled while your dialog is open.
If your application has a shell that you want the dialog to be modal in
respect to, you should use that shell instead of faking one up. The
problem you will have here is that this fake shell is never disposed.
That would explain why you lock up because the shell is never disposed
so your loop is never exited.
--
Thanks,
Rich Kulp
|
|
|
|
Powered by
FUDForum. Page generated in 0.03546 seconds