1 11 package org.eclipse.ant.internal.ui.preferences; 12 13 14 import org.eclipse.ant.internal.ui.IAntUIConstants; 15 import org.eclipse.core.runtime.Assert; 16 import org.eclipse.core.runtime.IStatus; 17 18 23 public class StatusInfo implements IStatus { 24 25 private String fStatusMessage; 26 private int fSeverity; 27 28 31 public StatusInfo() { 32 this(OK, null); 33 } 34 35 41 public StatusInfo(int severity, String message) { 42 fStatusMessage= message; 43 fSeverity= severity; 44 } 45 46 49 public boolean isOK() { 50 return fSeverity == IStatus.OK; 51 } 52 53 56 public boolean isWarning() { 57 return fSeverity == IStatus.WARNING; 58 } 59 60 63 public boolean isInfo() { 64 return fSeverity == IStatus.INFO; 65 } 66 67 70 public boolean isError() { 71 return fSeverity == IStatus.ERROR; 72 } 73 74 77 public String getMessage() { 78 return fStatusMessage; 79 } 80 81 85 public void setError(String errorMessage) { 86 Assert.isNotNull(errorMessage); 87 fStatusMessage= errorMessage; 88 fSeverity= IStatus.ERROR; 89 } 90 91 95 public void setWarning(String warningMessage) { 96 Assert.isNotNull(warningMessage); 97 fStatusMessage= warningMessage; 98 fSeverity= IStatus.WARNING; 99 } 100 101 105 public void setInfo(String infoMessage) { 106 Assert.isNotNull(infoMessage); 107 fStatusMessage= infoMessage; 108 fSeverity= IStatus.INFO; 109 } 110 111 114 public void setOK() { 115 fStatusMessage= null; 116 fSeverity= IStatus.OK; 117 } 118 119 122 public boolean matches(int severityMask) { 123 return (fSeverity & severityMask) != 0; 124 } 125 126 130 public boolean isMultiStatus() { 131 return false; 132 } 133 134 137 public int getSeverity() { 138 return fSeverity; 139 } 140 141 144 public String getPlugin() { 145 return IAntUIConstants.PLUGIN_ID; 146 } 147 148 152 public Throwable getException() { 153 return null; 154 } 155 156 160 public int getCode() { 161 return fSeverity; 162 } 163 164 168 public IStatus[] getChildren() { 169 return new IStatus[0]; 170 } 171 172 } 173 | Popular Tags |