blob: 03474980621f660d058717d04b1d89213b10a8ec [file] [log] [blame]
package org.eclipse.epf.library.configuration.closure;
import org.eclipse.core.resources.IMarker;
import org.eclipse.epf.uma.MethodElement;
/**
* This class identifies a configuration error between two elements
*
* @author jxi
*
*/
public class ElementError extends ErrorInfo implements IConfigurationError {
public ElementError(
int errorLevel, String message,
Object ownerElement, Object causeElement,
int relation) {
super(errorLevel, message, ownerElement, causeElement, relation);
}
// methods for the IConfigurationError
//
public MethodElement getCauseMethodElement() {
if ( this.causeElement instanceof MethodElement) {
return (MethodElement)this.causeElement;
}
return null;
}
public MethodElement getErrorMethodElement() {
if ( this.ownerElement instanceof MethodElement ) {
return (MethodElement)this.ownerElement;
}
return null;
}
public String getId() {
MethodElement m1 = getErrorMethodElement();
MethodElement m2 = getCauseMethodElement();
if ( m1 != null && m2 != null ) {
return m1.getGuid() + "," + m2.getGuid();
}
return Integer.toHexString(this.hashCode());
}
public int getSeverity() {
switch (getErrorLevel() ) {
case ErrorInfo.ERROR:
return IMarker.SEVERITY_ERROR;
case ErrorInfo.WARNING:
return IMarker.SEVERITY_WARNING;
}
return IMarker.SEVERITY_INFO;
}
}