Java 类org.eclipse.xtext.linking.ILinkingDiagnosticMessageProvider 实例源码

项目:DialogScriptDSL    文件:CustomLinkingDiagnosticMessageProvider.java   
public DiagnosticMessage getUnresolvedProxyMessage(final ILinkingDiagnosticMessageProvider.ILinkingDiagnosticContext context) {
  EReference _reference = context.getReference();
  final EClass referenceType = _reference.getEReferenceType();
  String linkText = "";
  try {
    String _linkText = context.getLinkText();
    linkText = _linkText;
  } catch (final Throwable _t) {
    if (_t instanceof IllegalNodeException) {
      final IllegalNodeException e = (IllegalNodeException)_t;
      INode _node = e.getNode();
      String _text = _node.getText();
      linkText = _text;
    } else {
      throw Exceptions.sneakyThrow(_t);
    }
  }
  String _name = referenceType.getName();
  String _plus = ("Couldn\'t resolve reference to " + _name);
  String _plus_1 = (_plus + " \'");
  String _plus_2 = (_plus_1 + linkText);
  final String msg = (_plus_2 + "\'.");
  String _name_1 = referenceType.getName();
  DiagnosticMessage _diagnosticMessage = new DiagnosticMessage(msg, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC, _name_1, linkText);
  return _diagnosticMessage;
}
项目:xtext-core    文件:LazyLinkingResource.java   
/**
 * @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);
    }
}
项目:antlr4ide    文件:Antlr4RuntimeModuleTest.java   
@SuppressWarnings("unchecked")
@Test
public void configure() {
  Binder binder = createNiceMock(Binder.class);
  AnnotatedBindingBuilder<LangFactory> bindLangFactory = createMock(AnnotatedBindingBuilder.class);
  AnnotatedBindingBuilder<ILinkingDiagnosticMessageProvider.Extended> bindLinkingDMP = createMock(AnnotatedBindingBuilder.class);
  AnnotatedBindingBuilder<ILaunchManager> bindLaunchManager = createMock(AnnotatedBindingBuilder.class);
  final ILaunchManager launchManager = createMock(ILaunchManager.class);
  final AnnotatedBindingBuilder<Console> bindConsole = createMock(AnnotatedBindingBuilder.class);
  final Console console = createMock(Console.class);

  expect(binder.bind(LangFactory.class)).andReturn(bindLangFactory);
  expect(binder.bind(ILinkingDiagnosticMessageProvider.Extended.class)).andReturn(bindLinkingDMP);
  expect(binder.bind(ILaunchManager.class)).andReturn(bindLaunchManager);
  expect(binder.bind(Console.class)).andReturn(bindConsole);

  bindLangFactory.toInstance(LangFactory.eINSTANCE);

  expect(bindLinkingDMP.to(Antlr4MissingReferenceMessageProvider.class)).andReturn(null);

  bindLaunchManager.toInstance(launchManager);
  bindConsole.toInstance(console);

  Object[] mocks = {binder, bindLangFactory, bindLinkingDMP, launchManager, console };

  replay(mocks);

  new Antlr4RuntimeModule() {
    @Override
    protected ILaunchManager getLaunchManager() {
      return launchManager;
    }
    @Override
    protected Console getConsole() {
      return console;
    }
  }.configure(binder);

  verify(mocks);
}
项目:xtext-extras    文件:DefaultXbaseRuntimeModule.java   
/**
 * @since 2.9
 */
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() {
    return UnresolvedFeatureCallTypeAwareMessageProvider.class;
}
项目:xtext-extras    文件:DefaultXbaseWithAnnotationsRuntimeModule.java   
@Override
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() {
    return UnresolvedAnnotationTypeAwareMessageProvider.class;
}
项目:xtext-extras    文件:UnresolvedFeatureCallTypeAwareMessageProvider.java   
@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);
}
项目:xtext-core    文件:LazyLinkingResource.java   
protected DiagnosticMessage createDiagnosticMessage(Triple<EObject, EReference, INode> triple) {
    ILinkingDiagnosticMessageProvider.ILinkingDiagnosticContext context = createDiagnosticMessageContext(triple);
    DiagnosticMessage message = diagnosticMessageProvider.getUnresolvedProxyMessage(context);
    return message;
}
项目:xtext-core    文件:LazyLinkingResource.java   
public ILinkingDiagnosticMessageProvider getDiagnosticMessageProvider() {
    return diagnosticMessageProvider;
}
项目:xtext-core    文件:LazyLinkingResource.java   
public void setDiagnosticMessageProvider(ILinkingDiagnosticMessageProvider diagnosticMessageProvider) {
    this.diagnosticMessageProvider = diagnosticMessageProvider;
}
项目:xtext-core    文件:Linker.java   
public void setDiagnosticMessageProvider(ILinkingDiagnosticMessageProvider.Extended diagnosticMessageProvider) {
    this.diagnosticMessageProvider = diagnosticMessageProvider;
}
项目:xtext-core    文件:Linker.java   
public ILinkingDiagnosticMessageProvider.Extended getDiagnosticMessageProvider() {
    return diagnosticMessageProvider;
}
项目:xtext-core    文件:XtextRuntimeModule.java   
public Class<? extends ILinkingDiagnosticMessageProvider.Extended> bindILinkingDiagnosticMessageProvider() {
    return XtextLinkingDiagnosticMessageProvider.class;
}
项目:statecharts    文件:AbstractSCTResource.java   
protected DiagnosticMessage createDiagnosticMessage(Triple<EObject, EReference, INode> triple) {
    ILinkingDiagnosticMessageProvider.ILinkingDiagnosticContext context = createDiagnosticMessageContext(triple);
    DiagnosticMessage message = diagnosticMessageProvider.getUnresolvedProxyMessage(context);
    return message;
}
项目:PHDL    文件:PhdlUiModule.java   
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() {
    return PhdlLinkingDiagnosticMessageProvider.class;
}
项目:gama    文件:GamlRuntimeModule.java   
public Class<? extends ILinkingDiagnosticMessageProvider.Extended> bindILinkingDiagnosticMessageProvider() {
    return GamlLinkingErrorMessageProvider.class;
}
项目:txtUML    文件:XtxtUMLRuntimeModule.java   
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() {
    return XtxtUMLLinkingDiagnosticMessageProvider.class;
}
项目:DialogScriptDSL    文件:CharacterScriptRuntimeModule.java   
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() {
    return CustomLinkingDiagnosticMessageProvider.class;
}
项目:DialogScriptDSL    文件:DialogScriptRuntimeModule.java   
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() {
    return CustomLinkingDiagnosticMessageProvider.class;
}
项目:antlr4ide    文件:Antlr4RuntimeModule.java   
@Override
public void configure(final Binder binder) {
  checkNotNull(binder);

  super.configure(binder);

  binder.bind(LangFactory.class).toInstance(LangFactory.eINSTANCE);

  binder.bind(ILinkingDiagnosticMessageProvider.Extended.class)
      .to(Antlr4MissingReferenceMessageProvider.class);

  binder.bind(ILaunchManager.class).toInstance(getLaunchManager());

  binder.bind(Console.class).toInstance(getConsole());
}