diff options
author | Stephan Schwaer | 2015-07-13 14:01:28 +0200 |
---|---|---|
committer | Stephan Schwaer | 2015-07-13 14:01:28 +0200 |
commit | 54ceb190e61d301f7bad7d2f5e1ff2d5cb912d95 (patch) | |
tree | 5478713980c296f829511ce5d1d0d6fbe6946e0e /dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java | |
parent | [client] ImageUpload: Implement file selection dialog (diff) | |
download | tutor-module-54ceb190e61d301f7bad7d2f5e1ff2d5cb912d95.tar.gz tutor-module-54ceb190e61d301f7bad7d2f5e1ff2d5cb912d95.tar.xz tutor-module-54ceb190e61d301f7bad7d2f5e1ff2d5cb912d95.zip |
[client] Fix freezing of mainWindow when clicking close button.
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java index 2aed0ff5..0c4cb15a 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java @@ -6,6 +6,8 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.log4j.Logger; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; @@ -15,6 +17,7 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.openslx.dozmod.Config; import org.openslx.dozmod.gui.helper.CompositePage; @@ -102,6 +105,19 @@ public abstract class MainWindow { static { // init SWT stuff mainShell = new Shell(Gui.display, SWT.SHELL_TRIM | SWT.CENTER); + + // TODO catch the close button to cleanup +// mainShell.addListener(SWT.Close, new Listener() +// { +// public void handleEvent(Event event) +// { +// int style = SWT.APPLICATION_MODAL | SWT.YES | SWT.NO; +// MessageBox messageBox = new MessageBox(mainShell, style); +// messageBox.setText("Information"); +// messageBox.setMessage("Close the shell?"); +// event.doit = messageBox.open() == SWT.YES; +// } +// }); // Set up thrift error message displaying ThriftManager.setErrorCallback(new ErrorCallback() { @@ -140,6 +156,14 @@ public abstract class MainWindow { System.exit(0); } }); + + mainShell.addDisposeListener(new DisposeListener() { + + @Override + public void widgetDisposed(DisposeEvent e) { + System.exit(0); + } + }); createMenu(); @@ -193,6 +217,8 @@ public abstract class MainWindow { window.setLayoutData(gd); window.setVisible(false); } + + private static void createMenu() { // the File menu button |