1 11 package org.eclipse.ui.internal.editors.text; 12 13 import org.eclipse.core.runtime.Assert; 14 import org.eclipse.core.runtime.IStatus; 15 16 17 import org.eclipse.ui.editors.text.EditorsUI; 18 19 26 class StatusInfo implements IStatus { 27 28 29 private String fStatusMessage; 30 31 private int fSeverity; 32 33 36 public StatusInfo() { 37 this(OK, null); 38 } 39 40 47 public StatusInfo(int severity, String message) { 48 fStatusMessage= message; 49 fSeverity= severity; 50 } 51 52 55 public boolean isOK() { 56 return fSeverity == IStatus.OK; 57 } 58 59 65 public boolean isWarning() { 66 return fSeverity == IStatus.WARNING; 67 } 68 69 75 public boolean isInfo() { 76 return fSeverity == IStatus.INFO; 77 } 78 79 85 public boolean isError() { 86 return fSeverity == IStatus.ERROR; 87 } 88 89 92 public String getMessage() { 93 return fStatusMessage; 94 } 95 96 101 public void setError(String errorMessage) { 102 Assert.isNotNull(errorMessage); 103 fStatusMessage= errorMessage; 104 fSeverity= IStatus.ERROR; 105 } 106 107 112 public void setWarning(String warningMessage) { 113 Assert.isNotNull(warningMessage); 114 fStatusMessage= warningMessage; 115 fSeverity= IStatus.WARNING; 116 } 117 118 123 public void setInfo(String infoMessage) { 124 Assert.isNotNull(infoMessage); 125 fStatusMessage= infoMessage; 126 fSeverity= IStatus.INFO; 127 } 128 129 132 public void setOK() { 133 fStatusMessage= null; 134 fSeverity= IStatus.OK; 135 } 136 137 140 public boolean matches(int severityMask) { 141 return (fSeverity & severityMask) != 0; 142 } 143 144 149 public boolean isMultiStatus() { 150 return false; 151 } 152 153 156 public int getSeverity() { 157 return fSeverity; 158 } 159 160 163 public String getPlugin() { 164 return EditorsUI.PLUGIN_ID; 165 } 166 167 172 public Throwable getException() { 173 return null; 174 } 175 176 181 public int getCode() { 182 return fSeverity; 183 } 184 185 190 public IStatus[] getChildren() { 191 return new IStatus[0]; 192 } 193 194 } 195 | Popular Tags |