use of org.eclipse.xtext.diagnostics.DiagnosticMessage in project xtext-xtend by eclipse.
the class Linker method afterCreateAndSetProxy.
@Override
protected void afterCreateAndSetProxy(EObject obj, INode node, EReference eRef, CrossReference xref, IDiagnosticProducer diagnosticProducer) {
AbstractElement terminal = xref.getTerminal();
if (!(terminal instanceof RuleCall)) {
throw new IllegalArgumentException(String.valueOf(xref));
}
AbstractRule rule = ((RuleCall) terminal).getRule();
try {
String tokenText = NodeModelUtils.getTokenText(node);
valueConverterService.toValue(tokenText, rule.getName(), node);
} catch (ValueConverterException e) {
diagnosticProducer.addDiagnostic(new DiagnosticMessage(e.getMessage(), Severity.ERROR, Diagnostic.SYNTAX_DIAGNOSTIC, Strings.EMPTY_ARRAY));
}
}
use of org.eclipse.xtext.diagnostics.DiagnosticMessage in project xtext-core by eclipse.
the class LinkingDiagnosticMessageProvider method getUnresolvedProxyMessage.
@Override
public DiagnosticMessage getUnresolvedProxyMessage(ILinkingDiagnosticContext context) {
EClass referenceType = context.getReference().getEReferenceType();
String linkText = "";
try {
linkText = context.getLinkText();
} catch (IllegalNodeException e) {
linkText = e.getNode().getText();
}
String msg = "Couldn't resolve reference to " + referenceType.getName() + " '" + linkText + "'.";
return new DiagnosticMessage(msg, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
use of org.eclipse.xtext.diagnostics.DiagnosticMessage in project xtext-core by eclipse.
the class LazyLinkingResource method createDiagnosticMessage.
protected DiagnosticMessage createDiagnosticMessage(Triple<EObject, EReference, INode> triple) {
ILinkingDiagnosticMessageProvider.ILinkingDiagnosticContext context = createDiagnosticMessageContext(triple);
DiagnosticMessage message = diagnosticMessageProvider.getUnresolvedProxyMessage(context);
return message;
}
use of org.eclipse.xtext.diagnostics.DiagnosticMessage in project xtext-core by eclipse.
the class LazyLinkingResource method createAndAddDiagnostic.
/**
* @since 2.3
*/
protected void createAndAddDiagnostic(Triple<EObject, EReference, INode> triple, IllegalNodeException ex) {
if (isValidationDisabled())
return;
ILinkingDiagnosticMessageProvider.ILinkingDiagnosticContext context = createDiagnosticMessageContext(triple);
DiagnosticMessage message = linkingDiagnosticMessageProvider.getIllegalNodeMessage(context, ex);
if (message != null) {
List<Diagnostic> list = getDiagnosticList(message);
Diagnostic diagnostic = createDiagnostic(triple, message);
if (!list.contains(diagnostic))
list.add(diagnostic);
}
}
use of org.eclipse.xtext.diagnostics.DiagnosticMessage in project xtext-core by eclipse.
the class LazyLinkingResource method createAndAddDiagnostic.
protected void createAndAddDiagnostic(Triple<EObject, EReference, INode> triple) {
if (isValidationDisabled())
return;
DiagnosticMessage message = createDiagnosticMessage(triple);
if (message != null) {
List<Diagnostic> list = getDiagnosticList(message);
Diagnostic diagnostic = createDiagnostic(triple, message);
if (!list.contains(diagnostic))
list.add(diagnostic);
}
}
Aggregations