protected void addSyntaxErrors() { getErrors().addAll(createDiagnostics(parseResult)); }
protected void clearErrorsAndWarnings() { getWarnings().clear(); getErrors().clear(); }
/** * @see org.eclipse.xtext.ui.editor.model.IXtextModelListener#modelChanged(org.eclipse.xtext.resource.XtextResource) */ public void modelChanged(XtextResource resource) { if (resource == null) return; boolean existingSyntaxErrors = Iterables.any(resource.getErrors(), new Predicate<Diagnostic>() { public boolean apply(Diagnostic diagnostic) { return diagnostic instanceof XtextSyntaxDiagnostic; } }); if (!existingSyntaxErrors) { calculateProjectionAnnotationModel(false); } }
public final XtextResource getResourceAndExpect(InputStream in, URI uri, int expectedErrors) throws Exception { XtextResource resource = doGetResource(in, uri); checkNodeModel(resource); if (expectedErrors != UNKNOWN_EXPECTATION) { if (expectedErrors == EXPECT_ERRORS) assertFalse(Joiner.on('\n').join(resource.getErrors()), resource.getErrors().isEmpty()); else assertEquals(Joiner.on('\n').join(resource.getErrors()), expectedErrors, resource.getErrors().size()); } for(Diagnostic d: resource.getErrors()) { if (d instanceof ExceptionDiagnostic) fail(d.getMessage()); } if (expectedErrors == 0 && resource.getContents().size() > 0 && shouldTestSerializer(resource)) { SerializerTester tester = get(SerializerTester.class); EObject obj = resource.getContents().get(0); tester.assertSerializeWithNodeModel(obj); tester.assertSerializeWithoutNodeModel(obj); } return resource; }
public final XtextResource getResourceAndExpect(InputStream in, URI uri, int expectedErrors) throws Exception { XtextResource resource = doGetResource(in, uri); if (expectedErrors != UNKNOWN_EXPECTATION) { if (expectedErrors == EXPECT_ERRORS) assertFalse(resource.getErrors().toString(), resource.getErrors().isEmpty()); else assertEquals(resource.getErrors().toString(), expectedErrors, resource.getErrors().size()); } for(Diagnostic d: resource.getErrors()) { if (d instanceof ExceptionDiagnostic) fail(d.getMessage()); } for(Diagnostic d: resource.getWarnings()) System.out.println("Resource Warning: "+d); if (expectedErrors == 0 && resource.getContents().size() > 0 && shouldTestSerializer(resource)) { SerializerTester tester = get(SerializerTester.class); EObject obj = resource.getContents().get(0); tester.assertSerializeWithNodeModel(obj); tester.assertSerializeWithoutNodeModel(obj); } return resource; }
public final XtextResource getResourceAndExpect(InputStream in, URI uri, int expectedErrors) throws Exception { XtextResource resource = doGetResource(in, uri); checkNodeModel(resource); if (expectedErrors != UNKNOWN_EXPECTATION) { if (expectedErrors == EXPECT_ERRORS) assertFalse(resource.getErrors().toString(), resource.getErrors().isEmpty()); else assertEquals(resource.getErrors().toString(), expectedErrors, resource.getErrors().size()); } for(Diagnostic d: resource.getErrors()) { if (d instanceof ExceptionDiagnostic) fail(d.getMessage()); } for(Diagnostic d: resource.getWarnings()) System.out.println("Resource Warning: "+d); if (expectedErrors == 0 && resource.getContents().size() > 0 && shouldTestSerializer(resource)) { SerializerTester tester = get(SerializerTester.class); EObject obj = resource.getContents().get(0); tester.assertSerializeWithNodeModel(obj); tester.assertSerializeWithoutNodeModel(obj); } return resource; }
protected void doLinking() { if (parseResult == null || parseResult.getRootASTElement() == null) return; final ListBasedDiagnosticConsumer consumer = new ListBasedDiagnosticConsumer(); linker.linkModel(parseResult.getRootASTElement(), consumer); if (!validationDisabled) { getErrors().addAll(consumer.getResult(Severity.ERROR)); getWarnings().addAll(consumer.getResult(Severity.WARNING)); } }
throw new IllegalArgumentException(_plus_1); boolean _isEmpty_2 = resource.getErrors().isEmpty(); boolean _not_1 = (!_isEmpty_2); if (_not_1) { XtextGeneratorLanguage.LOG.error(resource.getErrors()); String _grammarUri_2 = this.getGrammarUri(); String _plus_2 = ("Problem parsing \'" + _grammarUri_2); String _plus_3 = (_plus_2 + "\':\n"); String _join = Joiner.on("\n").join(resource.getErrors()); String _plus_4 = (_plus_3 + _join); throw new IllegalStateException(_plus_4);
if (xResource.getErrors().isEmpty()) { debug(RESOLUTION, DEFAULT, ":Import resolved to " + nextResolvedUri.toString(), "Model Path=", modelPath, "FQ Model Name=", fqModelName, "Container=", containerUri, "Import URI=",