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