Project

General

Profile

Download (2.17 KB) Statistics
| Branch: | Tag: | Revision:
1 4231dc94 Katja Luther
// $Id$
2
/**
3
* Copyright (C) 2015 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.model;
11
12
13
import org.eclipse.core.runtime.IStatus;
14
import org.eclipse.jface.dialogs.ErrorDialog;
15
import org.eclipse.jface.dialogs.IDialogConstants;
16
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.graphics.Point;
18
import org.eclipse.swt.widgets.Shell;
19
20
21
/**
22
 * @author k.luther
23
 * @date Oct 7, 2015
24
 *
25
 */
26
public class CdmDeleteErrorDialog extends ErrorDialog {
27
28
29
        private static final int DIALOG_MAX_HEIGHT = 500;
30
31
        private final String stackTrace;
32
33
34
35
        /**
36
         * @param parentShell
37
         * @param dialogTitle
38
         * @param message
39
         * @param status
40
         * @param stackTrace
41
         */
42
        public CdmDeleteErrorDialog(Shell parentShell,
43
                String dialogTitle,
44
                String message,
45
                IStatus status,
46
                String stackTrace,
47
                Object[] updatedObjects) {
48
            super(parentShell,
49
                    dialogTitle,
50
                    message, status,
51
                    IStatus.OK| IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
52
            this.stackTrace = stackTrace;
53
            this.message = message == null ? status.getMessage()
54
                    : message + "\n " + status.getMessage(); //$NON-NLS-1$
55
        }
56
57
58
        /* (non-Javadoc)
59
         * @see org.eclipse.jface.dialogs.ErrorDialog#buttonPressed(int)
60
         */
61
        @Override
62
        protected void buttonPressed(int id) {
63
            super.buttonPressed(id);
64
            if (id == IDialogConstants.DETAILS_ID) {
65
                Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
66
                // set height to max allowed
67
                if(getShell().getSize().y > DIALOG_MAX_HEIGHT) {
68
                    getShell().setSize(getShell().getSize().x, 500);
69
                } else {
70
                    getShell().setSize(getShell().getSize().x, oldSize.y);
71
                }
72
            }
73
74
        }
75
76
77
78
79
80
81
82
83
84
}