Java Code Examples for org.eclipse.xtext.diagnostics.Diagnostic#LINKING_DIAGNOSTIC

The following examples show how to use org.eclipse.xtext.diagnostics.Diagnostic#LINKING_DIAGNOSTIC . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinkingDiagnosticMessageProvider.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public DiagnosticMessage getUnresolvedProxyMessage(ILinkingDiagnosticContext context) {
	String linkText = "";
	try {
		linkText = context.getLinkText();
	} catch (IllegalNodeException e) {
		linkText = e.getNode().getText();
	}

	String format = "Could not find declaration of %s '%s'";
	String type = context.getReference().getEReferenceType().getName();
	String message = String.format(format, "", linkText);
	if (!type.equals("EObject")) {
		message = String.format(format, type, linkText);
	}
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
Example 2
Source File: LinkingDiagnosticMessageProvider.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@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);
}
 
Example 3
Source File: LinkingDiagnosticMessageProvider.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public DiagnosticMessage getViolatedBoundsConstraintMessage(ILinkingDiagnosticContext context, int size) {
	String message = "Too many matches for reference to '" + context.getLinkText() + "'. " 
			+ "Feature " + context.getReference().getName() + " can only hold " + context.getReference().getUpperBound()
			+ " reference" + (context.getReference().getUpperBound() != 1 ? "s" : "") + " but found " + size + " candidate" +
			(size!=1 ? "s" : "");
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
Example 4
Source File: GamlLinkingErrorMessageProvider.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public DiagnosticMessage getViolatedBoundsConstraintMessage(final ILinkingDiagnosticContext context,
		final int size) {
	final String message = "Too many matches for reference to '" + context.getLinkText() + "'. " + "Feature "
			+ context.getReference().getName() + " can only hold " + context.getReference().getUpperBound()
			+ " reference" + (context.getReference().getUpperBound() != 1 ? "s" : "") + " but found " + size
			+ " candidate" + (size != 1 ? "s" : "");
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
Example 5
Source File: UnresolvedFeatureCallTypeAwareMessageProvider.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public DiagnosticMessage getUnresolvedProxyMessage(final ILinkingDiagnosticMessageProvider.ILinkingDiagnosticContext context) {
  String _xtrycatchfinallyexpression = null;
  try {
    _xtrycatchfinallyexpression = context.getLinkText();
  } catch (final Throwable _t) {
    if (_t instanceof IllegalNodeException) {
      final IllegalNodeException e = (IllegalNodeException)_t;
      _xtrycatchfinallyexpression = e.getNode().getText();
    } else {
      throw Exceptions.sneakyThrow(_t);
    }
  }
  String linkText = _xtrycatchfinallyexpression;
  if ((linkText == null)) {
    return null;
  }
  EObject contextObject = context.getContext();
  boolean _isStaticMemberCallTarget = this.isStaticMemberCallTarget(contextObject);
  if (_isStaticMemberCallTarget) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append(linkText);
    _builder.append(" cannot be resolved to a type.");
    return new DiagnosticMessage(_builder.toString(), Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC, 
      UnresolvedFeatureCallTypeAwareMessageProvider.TYPE_LITERAL);
  }
  if ((contextObject instanceof XAbstractFeatureCall)) {
    boolean _isOperation = ((XAbstractFeatureCall)contextObject).isOperation();
    boolean _not = (!_isOperation);
    if (_not) {
      return this.handleUnresolvedFeatureCall(context, ((XAbstractFeatureCall)contextObject), linkText);
    }
  }
  EClass referenceType = context.getReference().getEReferenceType();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append(linkText);
  _builder_1.append(" cannot be resolved");
  String _typeName = this.getTypeName(referenceType, context.getReference());
  _builder_1.append(_typeName);
  _builder_1.append(".");
  final String msg = _builder_1.toString();
  return new DiagnosticMessage(msg, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC, linkText);
}
 
Example 6
Source File: LinkingDiagnosticMessageProvider.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public DiagnosticMessage getIllegalNodeMessage(ILinkingDiagnosticContext context, IllegalNodeException ex) {
	String message = ex.getMessage();
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
Example 7
Source File: LinkingDiagnosticMessageProvider.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public DiagnosticMessage getIllegalCrossReferenceMessage(ILinkingDiagnosticContext context, CrossReference reference) {
	String message = "Cannot find reference " + reference;
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
Example 8
Source File: LinkingDiagnosticMessageProvider.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public DiagnosticMessage getViolatedUniqueConstraintMessage(ILinkingDiagnosticContext context) {
	String message = "Cannot refer to '" + context.getLinkText() + "' more than once.";
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
Example 9
Source File: LinkingWarningsTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public DiagnosticMessage getUnresolvedProxyMessage(ILinkingDiagnosticContext context) {
	return new DiagnosticMessage(expected, Severity.WARNING, Diagnostic.LINKING_DIAGNOSTIC);
}
 
Example 10
Source File: GamlLinkingErrorMessageProvider.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public DiagnosticMessage getIllegalNodeMessage(final ILinkingDiagnosticContext context,
		final IllegalNodeException ex) {
	final String message = ex.getMessage();
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
Example 11
Source File: GamlLinkingErrorMessageProvider.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public DiagnosticMessage getIllegalCrossReferenceMessage(final ILinkingDiagnosticContext context,
		final CrossReference reference) {
	final String message = "Cannot find reference " + reference;
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
Example 12
Source File: GamlLinkingErrorMessageProvider.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public DiagnosticMessage getViolatedUniqueConstraintMessage(final ILinkingDiagnosticContext context) {
	final String message = "Cannot refer to '" + context.getLinkText() + "' more than once.";
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}