//The Main Window
display = new Display();
mainWindow = new Shell(display, SWT.RESIZE | SWT.BORDER | SWT.CLOSE | SWT.MAX | SWT.MIN);
mainWindow.setText("Test OSX"); //$NON-NLS-1$
/*Listener printer = new Listener() {
public void handleEvent(Event evt) {
System.out.println("-->" + evt.type);
}
};
mainWindow.addListener(SWT.Close,printer);
mainWindow.addListener(SWT.Dispose,printer);
mainWindow.addListener(SWT.KeyDown,printer);
mainWindow.addListener(SWT.KeyUp,printer);
*/
mainWindow.open();
//mainWindow.forceActive();
/*
mainWindow.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent arg0) {
System.out.println("NICO disposelistener 002\n");
if (mainWindow != null) {
System.out.println("NICO disposelistener 002a\n");
mainWindow.removeDisposeListener(this);
System.out.println("NICO disposelistener 002b\n");
dispose();
System.out.println("NICO disposelistener 002c\n");
}
System.out.println("NICO disposelistener 003\n");
}
});
*/
mainWindow.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent event) {
if(getExitConfirmation()) {
dispose();
} else {
event.doit = false;
}
}
});