summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:28:15 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:28:15 +0000
commitc901c0e5cc0a42bb9af0c868fe49412cc1e9058a (patch)
tree987643f4c5b7fdb3c8b4c440cd5c3186ba425666 /pdf-over-gui/src/main/java/at/asit
parentc2602f46edd68e81cf66fffca3d0dccfdfab4ddc (diff)
downloadmocca-c901c0e5cc0a42bb9af0c868fe49412cc1e9058a.tar.gz
mocca-c901c0e5cc0a42bb9af0c868fe49412cc1e9058a.tar.bz2
mocca-c901c0e5cc0a42bb9af0c868fe49412cc1e9058a.zip
Save configuration (and window size) on close
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@337 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
index 92688c82..b65a1f17 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
@@ -16,6 +16,7 @@
package at.asit.pdfover.gui;
// Imports
+import java.io.IOException;
import java.io.InputStream;
import java.util.EnumMap;
import java.util.Map;
@@ -25,6 +26,8 @@ import org.eclipse.swt.SWTError;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.ShellAdapter;
+import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Rectangle;
@@ -216,7 +219,20 @@ public class MainWindow {
catch (SWTError e) {
log.debug("Cannot get display", e); //$NON-NLS-1$
}
- getShell().setText(Messages.getString("main.title")); //$NON-NLS-1$
+ this.shell.setText(Messages.getString("main.title")); //$NON-NLS-1$
+
+ this.shell.addShellListener(new ShellAdapter() {
+ @Override
+ public void shellClosed(ShellEvent e) {
+ log.debug("Closing main window"); //$NON-NLS-1$
+ MainWindow.this.stateMachine.getConfigManipulator().setMainWindowSize(getShell().getSize());
+ try {
+ MainWindow.this.stateMachine.getConfigManipulator().saveCurrentConfiguration();
+ } catch (IOException e1) {
+ log.error("Error saving configuration", e); //$NON-NLS-1$
+ }
+ }
+ });
ImageData data = new ImageData(this.getClass().getResourceAsStream("/icons/icon.png"));//$NON-NLS-1$
Image shellicon = new Image(this.shell.getDisplay(), data);