1 package net.sourceforge.phpdt.externaltools.internal.ui;
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 **********************************************************************/
10 import net.sourceforge.phpdt.externaltools.model.IExternalToolConstants;
12 import org.eclipse.core.runtime.IStatus;
14 //import org.eclipse.jface.text.Assert;
15 import org.eclipse.core.runtime.Assert;
18 * A settable IStatus. Can be an error, warning, info or ok. For error, info and
19 * warning states, a message describes the problem.
21 public class StatusInfo implements IStatus {
23 private String fStatusMessage;
25 private int fSeverity;
28 * Creates a status set to OK (no message)
38 * The status severity: ERROR, WARNING, INFO and OK.
40 * The message of the status. Applies only for ERROR, WARNING and
43 public StatusInfo(int severity, String message) {
44 fStatusMessage = message;
49 * Returns if the status' severity is OK.
51 public boolean isOK() {
52 return fSeverity == IStatus.OK;
56 * Returns if the status' severity is WARNING.
58 // public boolean isWarning() {
59 // return fSeverity == IStatus.WARNING;
63 * Returns if the status' severity is INFO.
65 // public boolean isInfo() {
66 // return fSeverity == IStatus.INFO;
70 * Returns if the status' severity is ERROR.
72 // public boolean isError() {
73 // return fSeverity == IStatus.ERROR;
77 * @see IStatus#getMessage
79 public String getMessage() {
80 return fStatusMessage;
84 * Sets the status to ERROR.
87 * error message (can be empty, but not null)
89 public void setError(String errorMessage) {
90 Assert.isNotNull(errorMessage);
91 fStatusMessage = errorMessage;
92 fSeverity = IStatus.ERROR;
96 * Sets the status to WARNING.
99 * warning message (can be empty, but not null)
101 // public void setWarning(String warningMessage) {
102 // Assert.isNotNull(warningMessage);
103 // fStatusMessage = warningMessage;
104 // fSeverity = IStatus.WARNING;
108 * Sets the status to INFO.
111 * info message (can be empty, but not null)
113 // public void setInfo(String infoMessage) {
114 // Assert.isNotNull(infoMessage);
115 // fStatusMessage = infoMessage;
116 // fSeverity = IStatus.INFO;
120 * Sets the status to OK.
122 // public void setOK() {
123 // fStatusMessage = null;
124 // fSeverity = IStatus.OK;
128 * @see IStatus#matches(int)
130 public boolean matches(int severityMask) {
131 return (fSeverity & severityMask) != 0;
135 * Returns always <code>false</code>.
137 * @see IStatus#isMultiStatus()
139 public boolean isMultiStatus() {
144 * @see IStatus#getSeverity()
146 public int getSeverity() {
151 * @see IStatus#getPlugin()
153 public String getPlugin() {
154 return IExternalToolConstants.PLUGIN_ID;
158 * Returns always <code>null</code>.
160 * @see IStatus#getException()
162 public Throwable getException() {
167 * Returns always the error severity.
169 * @see IStatus#getCode()
171 public int getCode() {
176 * Returns always <code>null</code>.
178 * @see IStatus#getChildren()
180 public IStatus[] getChildren() {
181 return new IStatus[0];