use of org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic in project xtext-core by eclipse.
the class CrossReferenceSerializer method getCrossReferenceNameFromScope.
protected String getCrossReferenceNameFromScope(EObject semanticObject, CrossReference crossref, EObject target, final IScope scope, Acceptor errors) {
String ruleName = linkingHelper.getRuleNameFrom(crossref);
boolean foundOne = false;
List<ISerializationDiagnostic> recordedErrros = null;
for (IEObjectDescription desc : scope.getElements(target)) {
foundOne = true;
String unconverted = qualifiedNameConverter.toString(desc.getName());
try {
return valueConverter.toString(unconverted, ruleName);
} catch (ValueConverterException e) {
if (errors != null) {
if (recordedErrros == null)
recordedErrros = Lists.newArrayList();
recordedErrros.add(diagnostics.getValueConversionExceptionDiagnostic(semanticObject, crossref, unconverted, e));
}
}
}
if (errors != null) {
if (recordedErrros != null)
for (ISerializationDiagnostic diag : recordedErrros) errors.accept(diag);
if (!foundOne)
errors.accept(diagnostics.getNoEObjectDescriptionFoundDiagnostic(semanticObject, crossref, target, scope));
}
return null;
}
Aggregations