Search in sources :

Example 1 with Severity

use of org.eclipse.mylyn.wikitext.validation.ValidationProblem.Severity in project mylyn.docs by eclipse.

the class TestMarkupValidationRule method findProblem.

@Override
public ValidationProblem findProblem(String markup, int offset, int length) {
    Matcher matcher = pattern.matcher(markup);
    if (offset > 0 || length != markup.length()) {
        matcher.region(offset, offset + length);
    }
    if (matcher.find()) {
        String group = matcher.group(1);
        Severity severity;
        if ("ERROR".equals(group)) {
            severity = Severity.ERROR;
        } else {
            severity = Severity.WARNING;
        }
        return new ValidationProblem(severity, "test error", matcher.start(1), matcher.end(1) - matcher.start(1));
    }
    return null;
}
Also used : Matcher(java.util.regex.Matcher) ValidationProblem(org.eclipse.mylyn.wikitext.validation.ValidationProblem) Severity(org.eclipse.mylyn.wikitext.validation.ValidationProblem.Severity)

Aggregations

Matcher (java.util.regex.Matcher)1 ValidationProblem (org.eclipse.mylyn.wikitext.validation.ValidationProblem)1 Severity (org.eclipse.mylyn.wikitext.validation.ValidationProblem.Severity)1