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; }
/** * @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); } }
@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); }
/** * @since 2.9 */ public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() { return UnresolvedFeatureCallTypeAwareMessageProvider.class; }
@Override public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() { return UnresolvedAnnotationTypeAwareMessageProvider.class; }
@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); }
protected DiagnosticMessage createDiagnosticMessage(Triple<EObject, EReference, INode> triple) { ILinkingDiagnosticMessageProvider.ILinkingDiagnosticContext context = createDiagnosticMessageContext(triple); DiagnosticMessage message = diagnosticMessageProvider.getUnresolvedProxyMessage(context); return message; }
public ILinkingDiagnosticMessageProvider getDiagnosticMessageProvider() { return diagnosticMessageProvider; }
public void setDiagnosticMessageProvider(ILinkingDiagnosticMessageProvider diagnosticMessageProvider) { this.diagnosticMessageProvider = diagnosticMessageProvider; }
public void setDiagnosticMessageProvider(ILinkingDiagnosticMessageProvider.Extended diagnosticMessageProvider) { this.diagnosticMessageProvider = diagnosticMessageProvider; }
public ILinkingDiagnosticMessageProvider.Extended getDiagnosticMessageProvider() { return diagnosticMessageProvider; }
public Class<? extends ILinkingDiagnosticMessageProvider.Extended> bindILinkingDiagnosticMessageProvider() { return XtextLinkingDiagnosticMessageProvider.class; }
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() { return PhdlLinkingDiagnosticMessageProvider.class; }
public Class<? extends ILinkingDiagnosticMessageProvider.Extended> bindILinkingDiagnosticMessageProvider() { return GamlLinkingErrorMessageProvider.class; }
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() { return XtxtUMLLinkingDiagnosticMessageProvider.class; }
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() { return CustomLinkingDiagnosticMessageProvider.class; }
@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()); }