Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Close all child shells?
Close all child shells? [message #440181] Sun, 25 July 2004 08:59 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>
>
Previous Topic:date/calendar drop-down
Next Topic:Input MessageDialog
Goto Forum:
  


Current Time: Thu Apr 25 21:45:48 GMT 2024

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

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

Back to the top