fix #774 infinite loop in net.sourceforge.phpeclipse.builder.IdentifierIndexManager...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / PHPUIStatus.java
1 /*
2  * (c) Copyright IBM Corp. 2000, 2001.
3  * All Rights Reserved.
4  */
5 package net.sourceforge.phpdt.internal.ui;
6
7 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
8
9 import org.eclipse.core.runtime.IStatus;
10 import org.eclipse.core.runtime.Status;
11
12 /**
13  * Convenience class for error exceptions thrown inside PHPeclipse plugin.
14  */
15 public class PHPUIStatus extends Status {
16
17         public PHPUIStatus(int code) {
18                 this(code, ""); //$NON-NLS-1$
19         }
20
21         private PHPUIStatus(int severity, int code, String message,
22                         Throwable throwable) {
23                 super(severity, PHPeclipsePlugin.getPluginId(), code, message,
24                                 throwable);
25         }
26
27         public PHPUIStatus(int code, String message) {
28                 this(code, message, null);
29         }
30
31         public PHPUIStatus(int code, String message, Throwable throwable) {
32                 super(IStatus.ERROR, PHPeclipsePlugin.getPluginId(), code, message,
33                                 throwable);
34         }
35
36         public static IStatus createError(int code, Throwable throwable) {
37                 String message = throwable.getMessage();
38                 if (message == null) {
39                         message = throwable.getClass().getName();
40                 }
41                 return new PHPUIStatus(IStatus.ERROR, code, message, throwable);
42         }
43
44         public static IStatus createError(int code, String message,
45                         Throwable throwable) {
46                 return new PHPUIStatus(IStatus.ERROR, code, message, throwable);
47         }
48
49         public static IStatus createInfo(int code, String message,
50                         Throwable throwable) {
51                 return new PHPUIStatus(IStatus.INFO, code, message, throwable);
52         }
53
54         public static IStatus createWarning(int code, String message,
55                         Throwable throwable) {
56                 return new PHPUIStatus(IStatus.WARNING, code, message, throwable);
57         }
58 }