/*******************************************************************************
* Copyright (c) 2009, 2010 Sven Kiera
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.phpsrc.eclipse.pti.ui.dialogs;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class MessageDialog {
/**
* Opens an error dialog to display the given error. Use this method if the
* error object being displayed does not contain child items, or if you wish
* to display all such items without filtering.
*
* @param parent
* the parent shell of the dialog, or <code>null</code> if none
* @param dialogTitle
* the title to use for this dialog, or <code>null</code> to
* indicate that the default title should be used
* @param message
* the message to show in this dialog, or <code>null</code> to
* indicate that the error's message should be shown as the
* primary message
* @param status
* the error to show to the user
*/
public static void openError(final Shell parent, final String dialogTitle, final String message,
final IStatus status) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
ErrorDialog.openError(parent, dialogTitle, message, status);
}
});
}
/**
* Opens an error dialog to display the given error. Use this method if the
* error object being displayed contains child items <it>and </it> you wish
* to specify a mask which will be used to filter the displaying of these
* children. The error dialog will only be displayed if there is at least
* one child status matching the mask.
*
* @param parentShell
* the parent shell of the dialog, or <code>null</code> if none
* @param title
* the title to use for this dialog, or <code>null</code> to
* indicate that the default title should be used
* @param message
* the message to show in this dialog, or <code>null</code> to
* indicate that the error's message should be shown as the
* primary message
* @param status
* the error to show to the user
* @param displayMask
* the mask to use to filter the displaying of child items, as
* per <code>IStatus.matches</code>
* @see org.eclipse.core.runtime.IStatus#matches(int)
*/
public static void openError(final Shell parentShell, final String title, final String message,
final IStatus status, final int displayMask) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
ErrorDialog.openError(parentShell, title, message, status, displayMask);
}
});
}
}