blob: ba3815bddd48e2c708faa5b05f1a3ba1c9daa30e [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.tests.dialogs;
import junit.framework.TestCase;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.tests.util.DialogCheck;
public class UIErrorDialogs extends TestCase {
public UIErrorDialogs(String name) {
super(name);
}
private Shell getShell() {
return DialogCheck.getShell();
}
/*
* Get an example ErrorDialog with a status and a couple of
* child statuses.
*/
private ErrorDialog getMultiStatusErrorDialog() {
IStatus[] childStatuses = new IStatus[2];
childStatuses[0] =
new Status(
IStatus.ERROR,
"org.eclipse.ui.tests",
IStatus.ERROR,
"Error message 1",
new Throwable());
childStatuses[1] =
new Status(
IStatus.ERROR,
"org.eclipse.ui.tests",
IStatus.ERROR,
"Error message 2",
new Throwable());
MultiStatus mainStatus =
new MultiStatus(
"org.eclipse.ui.tests",
IStatus.ERROR,
childStatuses,
"Main error",
new Throwable());
return new ErrorDialog(
getShell(),
"Error Test",
"Error message",
mainStatus,
IStatus.ERROR);
}
public void testErrorClipboard() {
Dialog dialog = getMultiStatusErrorDialog();
DialogCheck.assertDialog(dialog, this);
}
}