Close all child shells? [message #440181] |
Sun, 25 July 2004 08:59 |
Eclipse User |
|
|
|
Originally posted by: gimm.us.ibm.com
I have an SWT standalone application that invokes various wizards and
inputdialogs. I want the user to be able to exit the application while any
of these dialogs are presented and have them close automatically. I would
think that the following code would work, but I keep getting the notorious
"Widget is disposed Exception" being thrown.
exitMenu.addSelectionListener(new SelectionListener()
{
public void widgetSelected(SelectionEvent e)
{
Shell shells[] = getShell().getShells();
for ( int i = 0; i < shells.length; i++ )
{
shells[i].close();
shells[i].dispose();
}
shell.close();
dispose(); // <= "Widget is disposed Exception" being thrown
here...
}
});
Now, if I call shell.getShells( ) again before I attempt to dispose the
parent shell it returns an empty array. I'm probably missing something here
but I'm not sure what. Any help is greatly appreciated!
Many thanks!
-Gim
|
|
|
Re: Close all child shells? [message #440182 is a reply to message #440181] |
Sun, 25 July 2004 09:13 |
Eclipse User |
|
|
|
Originally posted by: gimm.us.ibm.com
D'oh, this is what I get for working at 2am on a Saturday.
shell.close();
shell.dispose(); // <= Forgot the shell part...
Sorry for the trouble.
-Gim
"Gim Mahasintunan" <gimm@us.ibm.com> wrote in message
news:cdvshc$bqs$1@eclipse.org...
> I have an SWT standalone application that invokes various wizards and
> inputdialogs. I want the user to be able to exit the application while
any
> of these dialogs are presented and have them close automatically. I would
> think that the following code would work, but I keep getting the notorious
> "Widget is disposed Exception" being thrown.
>
> exitMenu.addSelectionListener(new SelectionListener()
> {
> public void widgetSelected(SelectionEvent e)
> {
> Shell shells[] = getShell().getShells();
>
> for ( int i = 0; i < shells.length; i++ )
> {
> shells[i].close();
> shells[i].dispose();
> }
>
> shell.close();
> dispose(); // <= "Widget is disposed Exception" being
thrown
> here...
> }
> });
>
> Now, if I call shell.getShells( ) again before I attempt to dispose the
> parent shell it returns an empty array. I'm probably missing something
here
> but I'm not sure what. Any help is greatly appreciated!
>
> Many thanks!
> -Gim
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03401 seconds