if (!SWT.getPlatform().equals("fox")) display.close();
display.close();
    public MainWindow(CoreCommunication core, final Shell shell) {        this.registeredTabs = new ArrayList();        this.mldonkey = core;        this.shell = shell;        Display display = shell.getDisplay();        shell.addShellListener(this);        minimizer = new Minimizer(shell, core, titleBarText);        minimizer.setTitleBarText();        shell.setLayout(new FillLayout());        Splash.increaseSplashBar("creating tabs");        createContents(shell);        shell.pack();        /* close the splashShell from G2Gui.java */        Splash.increaseSplashBar("view successfully started");        Splash.dispose();        /* set the old size of this window - must be after pack() */        setSizeLocation(shell);        // what do we do when the close button is selected        shell.addListener(SWT.Close,            new Listener() {                public void handleEvent(Event event) {                    event.doit = minimizer.close();                }            });        shell.open();        /* things we should do if we dispose */        shell.addDisposeListener(new DisposeListener() {                public synchronized void widgetDisposed(DisposeEvent e) {                    /* save the size of this window */                    saveSizeLocation(shell);                    /* set all tabs to inactive */                    Iterator itr = registeredTabs.iterator();                    while (itr.hasNext()) {                        GuiTab aTab = (GuiTab) itr.next();                        aTab.dispose();                    }                    // If we have created the core, kill it                    if (G2Gui.getCoreConsole() != null) {                        Message killCore = new EncodeMessage(Message.S_KILL_CORE);                        killCore.sendMessage(mldonkey);                        G2Gui.getCoreConsole().dispose();                    }                    // disconnect from core                    mldonkey.disconnect();                    // save preferences                    PreferenceLoader.saveStore();                    PreferenceLoader.cleanUp();                }            });        try {            while (!shell.isDisposed()) {                if (!display.readAndDispatch())                    display.sleep();            }        } catch (Exception e) {            if (G2Gui.debug)                e.printStackTrace();            else {                // getCause() seems always to be null unfortunately                StringWriter sw = new StringWriter();                e.printStackTrace(new PrintWriter(sw, true));                ErrorDialog errorDialog = new ErrorDialog(new Shell(display), sw.toString());                errorDialog.open();            }        }        // locks up swt-fox        if (!SWT.getPlatform().equals("fox"))            display.close();    }