Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / internal / ui / StatusInfo.java
1 package net.sourceforge.phpdt.externaltools.internal.ui;
2
3 /**********************************************************************
4  Copyright (c) 2000, 2002 IBM Corp.  All rights reserved.
5  This file is made available under the terms of the Common Public License v1.0
6  which accompanies this distribution, and is available at
7  http://www.eclipse.org/legal/cpl-v10.html
8  **********************************************************************/
9
10 import net.sourceforge.phpdt.externaltools.model.IExternalToolConstants;
11
12 import org.eclipse.core.runtime.IStatus;
13 //incastrix
14 //import org.eclipse.jface.text.Assert;
15 import org.eclipse.core.runtime.Assert;
16
17 /**
18  * A settable IStatus. Can be an error, warning, info or ok. For error, info and
19  * warning states, a message describes the problem.
20  */
21 public class StatusInfo implements IStatus {
22
23         private String fStatusMessage;
24
25         private int fSeverity;
26
27         /**
28          * Creates a status set to OK (no message)
29          */
30         public StatusInfo() {
31                 this(OK, null);
32         }
33
34         /**
35          * Creates a status .
36          * 
37          * @param severity
38          *            The status severity: ERROR, WARNING, INFO and OK.
39          * @param message
40          *            The message of the status. Applies only for ERROR, WARNING and
41          *            INFO.
42          */
43         public StatusInfo(int severity, String message) {
44                 fStatusMessage = message;
45                 fSeverity = severity;
46         }
47
48         /**
49          * Returns if the status' severity is OK.
50          */
51         public boolean isOK() {
52                 return fSeverity == IStatus.OK;
53         }
54
55         /**
56          * Returns if the status' severity is WARNING.
57          */
58 //      public boolean isWarning() {
59 //              return fSeverity == IStatus.WARNING;
60 //      }
61
62         /**
63          * Returns if the status' severity is INFO.
64          */
65 //      public boolean isInfo() {
66 //              return fSeverity == IStatus.INFO;
67 //      }
68
69         /**
70          * Returns if the status' severity is ERROR.
71          */
72 //      public boolean isError() {
73 //              return fSeverity == IStatus.ERROR;
74 //      }
75
76         /**
77          * @see IStatus#getMessage
78          */
79         public String getMessage() {
80                 return fStatusMessage;
81         }
82
83         /**
84          * Sets the status to ERROR.
85          * 
86          * @param The
87          *            error message (can be empty, but not null)
88          */
89         public void setError(String errorMessage) {
90                 Assert.isNotNull(errorMessage);
91                 fStatusMessage = errorMessage;
92                 fSeverity = IStatus.ERROR;
93         }
94
95         /**
96          * Sets the status to WARNING.
97          * 
98          * @param The
99          *            warning message (can be empty, but not null)
100          */
101 //      public void setWarning(String warningMessage) {
102 //              Assert.isNotNull(warningMessage);
103 //              fStatusMessage = warningMessage;
104 //              fSeverity = IStatus.WARNING;
105 //      }
106
107         /**
108          * Sets the status to INFO.
109          * 
110          * @param The
111          *            info message (can be empty, but not null)
112          */
113 //      public void setInfo(String infoMessage) {
114 //              Assert.isNotNull(infoMessage);
115 //              fStatusMessage = infoMessage;
116 //              fSeverity = IStatus.INFO;
117 //      }
118
119         /**
120          * Sets the status to OK.
121          */
122 //      public void setOK() {
123 //              fStatusMessage = null;
124 //              fSeverity = IStatus.OK;
125 //      }
126
127         /*
128          * @see IStatus#matches(int)
129          */
130         public boolean matches(int severityMask) {
131                 return (fSeverity & severityMask) != 0;
132         }
133
134         /**
135          * Returns always <code>false</code>.
136          * 
137          * @see IStatus#isMultiStatus()
138          */
139         public boolean isMultiStatus() {
140                 return false;
141         }
142
143         /*
144          * @see IStatus#getSeverity()
145          */
146         public int getSeverity() {
147                 return fSeverity;
148         }
149
150         /*
151          * @see IStatus#getPlugin()
152          */
153         public String getPlugin() {
154                 return IExternalToolConstants.PLUGIN_ID;
155         }
156
157         /**
158          * Returns always <code>null</code>.
159          * 
160          * @see IStatus#getException()
161          */
162         public Throwable getException() {
163                 return null;
164         }
165
166         /**
167          * Returns always the error severity.
168          * 
169          * @see IStatus#getCode()
170          */
171         public int getCode() {
172                 return fSeverity;
173         }
174
175         /**
176          * Returns always <code>null</code>.
177          * 
178          * @see IStatus#getChildren()
179          */
180         public IStatus[] getChildren() {
181                 return new IStatus[0];
182         }
183
184 }