summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:10:00 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:10:00 +0000
commit782c82871bdea8d6091e9335823240af8e0f04d7 (patch)
tree03bdcb6ce04b7bd1022bfcbf2e091d95515e0ee9 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java
parent880f96c5fd18d760f85e6814cb77ca908c4d8dc4 (diff)
downloadpdf-over-782c82871bdea8d6091e9335823240af8e0f04d7.tar.gz
pdf-over-782c82871bdea8d6091e9335823240af8e0f04d7.tar.bz2
pdf-over-782c82871bdea8d6091e9335823240af8e0f04d7.zip
+ ignore option for error dialog
+ resumeable exception for settings validation git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@168 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java52
1 files changed, 38 insertions, 14 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java
index 88392d98..7cefb857 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java
+++ b/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();
}
}