2 * (c) Copyright IBM Corp. 2000, 2001.
5 package net.sourceforge.phpdt.internal.ui;
7 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
9 import org.eclipse.core.runtime.IStatus;
10 import org.eclipse.core.runtime.Status;
13 * Convenience class for error exceptions thrown inside PHPeclipse plugin.
15 public class PHPUIStatus extends Status {
17 public PHPUIStatus(int code) {
18 this(code, ""); //$NON-NLS-1$
21 private PHPUIStatus(int severity, int code, String message,
22 Throwable throwable) {
23 super(severity, PHPeclipsePlugin.getPluginId(), code, message,
27 public PHPUIStatus(int code, String message) {
28 this(code, message, null);
31 public PHPUIStatus(int code, String message, Throwable throwable) {
32 super(IStatus.ERROR, PHPeclipsePlugin.getPluginId(), code, message,
36 public static IStatus createError(int code, Throwable throwable) {
37 String message = throwable.getMessage();
38 if (message == null) {
39 message = throwable.getClass().getName();
41 return new PHPUIStatus(IStatus.ERROR, code, message, throwable);
44 public static IStatus createError(int code, String message,
45 Throwable throwable) {
46 return new PHPUIStatus(IStatus.ERROR, code, message, throwable);
49 public static IStatus createInfo(int code, String message,
50 Throwable throwable) {
51 return new PHPUIStatus(IStatus.INFO, code, message, throwable);
54 public static IStatus createWarning(int code, String message,
55 Throwable throwable) {
56 return new PHPUIStatus(IStatus.WARNING, code, message, throwable);