Search in sources :

Example 16 with ExceptionDiagnostic

use of org.eclipse.xtext.diagnostics.ExceptionDiagnostic in project smarthome by eclipse.

the class ScriptParsingException method addDiagnosticErrors.

public ScriptParsingException addDiagnosticErrors(List<Diagnostic> errors) {
    for (Diagnostic emfDiagnosticError : errors) {
        if (emfDiagnosticError instanceof AbstractDiagnostic) {
            AbstractDiagnostic e = (AbstractDiagnostic) emfDiagnosticError;
            this.getErrors().add(new ScriptError(e.getMessage(), e.getLine(), e.getOffset(), e.getLength()));
        } else if (emfDiagnosticError instanceof ExceptionDiagnostic) {
            ExceptionDiagnostic e = (ExceptionDiagnostic) emfDiagnosticError;
            this.getErrors().add(new ScriptError(e.getMessage(), e.getLine(), e.getOffset(), e.getLength()));
        } else {
            this.getErrors().add(new ScriptError(emfDiagnosticError.getMessage(), -1, -1, -1));
        }
    }
    return this;
}
Also used : ExceptionDiagnostic(org.eclipse.xtext.diagnostics.ExceptionDiagnostic) Diagnostic(org.eclipse.emf.ecore.resource.Resource.Diagnostic) AbstractDiagnostic(org.eclipse.xtext.diagnostics.AbstractDiagnostic) ExceptionDiagnostic(org.eclipse.xtext.diagnostics.ExceptionDiagnostic) AbstractDiagnostic(org.eclipse.xtext.diagnostics.AbstractDiagnostic)

Aggregations

ExceptionDiagnostic (org.eclipse.xtext.diagnostics.ExceptionDiagnostic)16 Diagnostic (org.eclipse.emf.ecore.resource.Resource.Diagnostic)10 BasicDiagnostic (org.eclipse.emf.common.util.BasicDiagnostic)6 XtextResource (org.eclipse.xtext.resource.XtextResource)6 List (java.util.List)5 Resource (org.eclipse.emf.ecore.resource.Resource)5 Severity (org.eclipse.xtext.diagnostics.Severity)5 IDiagnosticConverter (org.eclipse.xtext.validation.IDiagnosticConverter)5 Issue (org.eclipse.xtext.validation.Issue)5 ResourceValidatorImpl (org.eclipse.xtext.validation.ResourceValidatorImpl)5 Test (org.junit.Test)4 ComparisonFailure (org.junit.ComparisonFailure)3 IOException (java.io.IOException)2 EObject (org.eclipse.emf.ecore.EObject)2 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 Expression (org.eclipse.n4js.n4JS.Expression)1 TypeRef (org.eclipse.n4js.ts.typeRefs.TypeRef)1 RuleEnvironment (org.eclipse.xsemantics.runtime.RuleEnvironment)1 RuleFailedException (org.eclipse.xsemantics.runtime.RuleFailedException)1 Grammar (org.eclipse.xtext.Grammar)1