1 11 package org.eclipse.jdt.internal.debug.ui; 12 13 import org.eclipse.core.runtime.Assert; 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.jdt.ui.JavaUI; 16 17 22 public class StatusInfo implements IStatus { 23 24 private String fStatusMessage; 25 private int fSeverity; 26 27 30 public StatusInfo() { 31 this(OK, null); 32 } 33 34 40 public StatusInfo(int severity, String message) { 41 fStatusMessage= message; 42 fSeverity= severity; 43 } 44 45 48 public boolean isOK() { 49 return fSeverity == IStatus.OK; 50 } 51 52 55 public boolean isWarning() { 56 return fSeverity == IStatus.WARNING; 57 } 58 59 62 public boolean isInfo() { 63 return fSeverity == IStatus.INFO; 64 } 65 66 69 public boolean isError() { 70 return fSeverity == IStatus.ERROR; 71 } 72 73 76 public String getMessage() { 77 return fStatusMessage; 78 } 79 80 84 public void setError(String errorMessage) { 85 Assert.isNotNull(errorMessage); 86 fStatusMessage= errorMessage; 87 fSeverity= IStatus.ERROR; 88 } 89 90 94 public void setWarning(String warningMessage) { 95 Assert.isNotNull(warningMessage); 96 fStatusMessage= warningMessage; 97 fSeverity= IStatus.WARNING; 98 } 99 100 104 public void setInfo(String infoMessage) { 105 Assert.isNotNull(infoMessage); 106 fStatusMessage= infoMessage; 107 fSeverity= IStatus.INFO; 108 } 109 110 113 public void setOK() { 114 fStatusMessage= null; 115 fSeverity= IStatus.OK; 116 } 117 118 121 public boolean matches(int severityMask) { 122 return (fSeverity & severityMask) != 0; 123 } 124 125 129 public boolean isMultiStatus() { 130 return false; 131 } 132 133 136 public int getSeverity() { 137 return fSeverity; 138 } 139 140 143 public String getPlugin() { 144 return JavaUI.ID_PLUGIN; 145 } 146 147 151 public Throwable getException() { 152 return null; 153 } 154 155 159 public int getCode() { 160 return fSeverity; 161 } 162 163 167 public IStatus[] getChildren() { 168 return new IStatus[0]; 169 } 170 171 } 172 | Popular Tags |