use of com.avaloq.tools.ddk.check.check.SeverityKind in project dsl-devkit by dsldevkit.
the class SeverityRangeImpl method setMinSeverity.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMinSeverity(SeverityKind newMinSeverity) {
SeverityKind oldMinSeverity = minSeverity;
minSeverity = newMinSeverity == null ? MIN_SEVERITY_EDEFAULT : newMinSeverity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CheckPackage.SEVERITY_RANGE__MIN_SEVERITY, oldMinSeverity, minSeverity));
}
use of com.avaloq.tools.ddk.check.check.SeverityKind in project dsl-devkit by dsldevkit.
the class CheckJavaValidator method checkDefaultSeverityInRange.
/**
* Checks that the default severity is within given severity range. There must not be a conflict such
* that the severity range defines severities do not contain the default.
* <p>
* Note that this check works even if {@link #checkSeverityRangeOrder(com.avaloq.tools.ddk.check.check.Check)} is violated.
* </p>
*
* @param check
* the check
*/
@Check
public void checkDefaultSeverityInRange(final com.avaloq.tools.ddk.check.check.Check check) {
if (check.getSeverityRange() == null) {
// only applicable if both range and default severity given
return;
}
final SeverityRange range = check.getSeverityRange();
final SeverityKind minSeverity = SeverityKind.get(Math.min(range.getMinSeverity().getValue(), range.getMaxSeverity().getValue()));
final SeverityKind maxSeverity = SeverityKind.get(Math.max(range.getMinSeverity().getValue(), range.getMaxSeverity().getValue()));
if (check.getDefaultSeverity().compareTo(minSeverity) < 0 || check.getDefaultSeverity().compareTo(maxSeverity) > 0) {
List<String> issueCodes = Lists.newArrayList();
SeverityKind temp = minSeverity;
while (temp != null && temp.compareTo(maxSeverity) <= 0) {
issueCodes.add(temp.getName());
temp = SeverityKind.get(temp.getValue() + 1);
}
String[] codes = issueCodes.toArray(new String[issueCodes.size()]);
error(Messages.CheckJavaValidator_DEFAULT_SEVERITY_NOT_IN_RANGE, check, CheckPackage.Literals.CHECK__DEFAULT_SEVERITY, IssueCodes.DEFAULT_SEVERITY_NOT_IN_RANGE, issueCodes.isEmpty() ? // NOPMD
null : codes);
}
}
use of com.avaloq.tools.ddk.check.check.SeverityKind in project dsl-devkit by dsldevkit.
the class SeverityRangeImpl method setMaxSeverity.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMaxSeverity(SeverityKind newMaxSeverity) {
SeverityKind oldMaxSeverity = maxSeverity;
maxSeverity = newMaxSeverity == null ? MAX_SEVERITY_EDEFAULT : newMaxSeverity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CheckPackage.SEVERITY_RANGE__MAX_SEVERITY, oldMaxSeverity, maxSeverity));
}
use of com.avaloq.tools.ddk.check.check.SeverityKind in project dsl-devkit by dsldevkit.
the class CheckImpl method setDefaultSeverity.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDefaultSeverity(SeverityKind newDefaultSeverity) {
SeverityKind oldDefaultSeverity = defaultSeverity;
defaultSeverity = newDefaultSeverity == null ? DEFAULT_SEVERITY_EDEFAULT : newDefaultSeverity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CheckPackage.CHECK__DEFAULT_SEVERITY, oldDefaultSeverity, defaultSeverity));
}
Aggregations