diff options
author | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-31 16:36:59 +0000 |
---|---|---|
committer | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-31 16:36:59 +0000 |
commit | 11b4582b7c2e2d5008931fa5029563efedda37a5 (patch) | |
tree | 15e4a4c1ca8ccad29bf66c6db1322550577b897b /trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls | |
parent | 846b13ac8d1e770be10ff3909509d872954be0fd (diff) | |
download | pdf-over-11b4582b7c2e2d5008931fa5029563efedda37a5.tar.gz pdf-over-11b4582b7c2e2d5008931fa5029563efedda37a5.tar.bz2 pdf-over-11b4582b7c2e2d5008931fa5029563efedda37a5.zip |
+ ignore option for error dialog
+ resumeable exception for settings validation
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12754 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls')
-rw-r--r-- | trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java index 88392d98..7cefb857 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java @@ -30,16 +30,44 @@ public class ErrorDialog { private MessageBox box; /** - * @param parent - * @param message - * @param canRetry + * Message box buttons */ - public ErrorDialog(Shell parent, String message, boolean canRetry) { + public enum ERROR_BUTTONS { + /** + * Display only ok button + */ + OK, + /** + * Display retry and cancel buttons + */ + RETRY_CANCEL, + /** + * Display abort, retry and ignore buttons + */ + ABORT_RETRY_IGNORE + }; + + /** + * @param parent The parent shell + * @param message The error message + * @param button The buttons to be shown + */ + public ErrorDialog(Shell parent, String message, ERROR_BUTTONS button) { + this.initialize(parent, message, button); + } + + private void initialize(Shell parent, String message, ERROR_BUTTONS button) { int boxstyle = SWT.ICON_ERROR ; - if(canRetry) { - boxstyle |= SWT.RETRY| SWT.CANCEL; - } else { + switch(button) { + case OK: boxstyle |= SWT.OK; + break; + case RETRY_CANCEL: + boxstyle |= SWT.RETRY| SWT.CANCEL; + break; + case ABORT_RETRY_IGNORE: + boxstyle |= SWT.RETRY| SWT.ABORT | SWT.IGNORE; + break; } this.box = new MessageBox(parent, boxstyle); @@ -50,13 +78,9 @@ public class ErrorDialog { /** * Open error dialog * - * @return if the user wants to retry the action which caused the error + * @return SWT.OK | SWT.IGNORE | SWT.ABORT | SWT.RETRY | SWT.CANCEL */ - public boolean open() { - int rc = this.box.open(); - if(rc == SWT.RETRY) { - return true; - } - return false; + public int open() { + return this.box.open(); } } |