use of org.eclipse.xtext.validation.Issue.IssueImpl in project xtext-core by eclipse.
the class DiagnosticConverterImpl method convertResourceDiagnostic.
@Override
public void convertResourceDiagnostic(Diagnostic diagnostic, Severity severity, IAcceptor<Issue> acceptor) {
IssueImpl issue = new Issue.IssueImpl();
issue.setSyntaxError(diagnostic instanceof XtextSyntaxDiagnostic);
issue.setSeverity(severity);
issue.setLineNumber(diagnostic.getLine());
issue.setColumn(diagnostic.getColumn());
issue.setMessage(diagnostic.getMessage());
if (diagnostic instanceof org.eclipse.xtext.diagnostics.Diagnostic) {
org.eclipse.xtext.diagnostics.Diagnostic xtextDiagnostic = (org.eclipse.xtext.diagnostics.Diagnostic) diagnostic;
issue.setOffset(xtextDiagnostic.getOffset());
issue.setLength(xtextDiagnostic.getLength());
}
if (diagnostic instanceof AbstractDiagnostic) {
AbstractDiagnostic castedDiagnostic = (AbstractDiagnostic) diagnostic;
issue.setUriToProblem(castedDiagnostic.getUriToProblem());
issue.setCode(castedDiagnostic.getCode());
issue.setData(castedDiagnostic.getData());
issue.setLineNumberEnd(castedDiagnostic.getLineEnd());
issue.setColumnEnd(castedDiagnostic.getColumnEnd());
}
issue.setType(CheckType.FAST);
acceptor.accept(issue);
}
use of org.eclipse.xtext.validation.Issue.IssueImpl in project xtext-core by eclipse.
the class DiagnosticConverterImpl method convertValidatorDiagnostic.
@Override
public void convertValidatorDiagnostic(org.eclipse.emf.common.util.Diagnostic diagnostic, IAcceptor<Issue> acceptor) {
Severity severity = getSeverity(diagnostic);
if (severity == null)
return;
IssueImpl issue = new Issue.IssueImpl();
issue.setSeverity(severity);
IssueLocation locationData = getLocationData(diagnostic);
if (locationData != null) {
issue.setLineNumber(locationData.lineNumber);
issue.setColumn(locationData.column);
issue.setOffset(locationData.offset);
issue.setLength(locationData.length);
issue.setLineNumberEnd(locationData.lineNumberEnd);
issue.setColumnEnd(locationData.columnEnd);
}
final EObject causer = getCauser(diagnostic);
if (causer != null)
issue.setUriToProblem(EcoreUtil.getURI(causer));
issue.setCode(getIssueCode(diagnostic));
issue.setType(getIssueType(diagnostic));
issue.setData(getIssueData(diagnostic));
// marker.put(IXtextResourceChecker.DIAGNOSTIC_KEY, diagnostic);
issue.setMessage(diagnostic.getMessage());
// marker.put(IMarker.PRIORITY, Integer.valueOf(IMarker.PRIORITY_LOW));
acceptor.accept(issue);
}
Aggregations