From: Katja Luther Date: Wed, 7 Oct 2015 12:14:43 +0000 (+0200) Subject: new ErrorDialog for delete result messaging X-Git-Tag: 3.12.0^2~113 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/4231dc945a5500ecf73817918a63fd0ff9f2d94e?hp=8336cf65f0318da2d4e4c1568049adff77818ef9 new ErrorDialog for delete result messaging --- 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 index 000000000..d3a5b522b --- /dev/null +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/CdmDeleteErrorDialog.java @@ -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); + } + } + + } + + + + + + + + + +}