new ErrorDialog for delete result messaging
authorKatja Luther <k.luther@bgbm.org>
Wed, 7 Oct 2015 12:14:43 +0000 (14:14 +0200)
committerKatja Luther <k.luther@bgbm.org>
Wed, 7 Oct 2015 12:14:43 +0000 (14:14 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/CdmDeleteErrorDialog.java [new file with mode: 0644]

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/CdmDeleteErrorDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/CdmDeleteErrorDialog.java
new file mode 100644 (file)
index 0000000..d3a5b52
--- /dev/null
@@ -0,0 +1,84 @@
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.model;
+
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * @author k.luther
+ * @date Oct 7, 2015
+ *
+ */
+public class CdmDeleteErrorDialog extends ErrorDialog {
+
+
+        private static final int DIALOG_MAX_HEIGHT = 500;
+
+        private final String stackTrace;
+
+
+
+        /**
+         * @param parentShell
+         * @param dialogTitle
+         * @param message
+         * @param status
+         * @param stackTrace
+         */
+        public CdmDeleteErrorDialog(Shell parentShell,
+                String dialogTitle,
+                String message,
+                IStatus status,
+                String stackTrace,
+                Object[] updatedObjects) {
+            super(parentShell,
+                    dialogTitle,
+                    message, status,
+                    IStatus.OK| IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
+            this.stackTrace = stackTrace;
+            this.message = message == null ? status.getMessage()
+                    : message + "\n " + status.getMessage(); //$NON-NLS-1$
+        }
+
+
+        /* (non-Javadoc)
+         * @see org.eclipse.jface.dialogs.ErrorDialog#buttonPressed(int)
+         */
+        @Override
+        protected void buttonPressed(int id) {
+            super.buttonPressed(id);
+            if (id == IDialogConstants.DETAILS_ID) {
+                Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+                // set height to max allowed
+                if(getShell().getSize().y > DIALOG_MAX_HEIGHT) {
+                    getShell().setSize(getShell().getSize().x, 500);
+                } else {
+                    getShell().setSize(getShell().getSize().x, oldSize.y);
+                }
+            }
+
+        }
+
+
+
+
+
+
+
+
+
+}