当前位置: 首页>>代码示例>>Java>>正文


Java Diagnostic.LINKING_DIAGNOSTIC属性代码示例

本文整理汇总了Java中org.eclipse.xtext.diagnostics.Diagnostic.LINKING_DIAGNOSTIC属性的典型用法代码示例。如果您正苦于以下问题:Java Diagnostic.LINKING_DIAGNOSTIC属性的具体用法?Java Diagnostic.LINKING_DIAGNOSTIC怎么用?Java Diagnostic.LINKING_DIAGNOSTIC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.xtext.diagnostics.Diagnostic的用法示例。


在下文中一共展示了Diagnostic.LINKING_DIAGNOSTIC属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUnresolvedProxyMessage

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;
}
 
开发者ID:RobertWalter83,项目名称:DialogScriptDSL,代码行数:26,代码来源:CustomLinkingDiagnosticMessageProvider.java

示例2: createMissingEntity

@Fix(Diagnostic.LINKING_DIAGNOSTIC)
public void createMissingEntity(final Issue issue, final IssueResolutionAcceptor acceptor) {
  final ISemanticModification _function = new ISemanticModification() {
    @Override
    public void apply(final EObject element, final IModificationContext context) throws Exception {
      Entity _containerOfType = EcoreUtil2.<Entity>getContainerOfType(element, Entity.class);
      IXtextDocument _xtextDocument = context.getXtextDocument();
      Integer _offset = issue.getOffset();
      Integer _length = issue.getLength();
      String _get = _xtextDocument.get((_offset).intValue(), (_length).intValue());
      EntitiesModelUtil.addEntityAfter(_containerOfType, _get);
    }
  };
  acceptor.accept(issue, 
    "Create missing entity", 
    "Create missing entity", 
    "Entity.gif", _function);
}
 
开发者ID:LorenzoBettini,项目名称:packtpub-xtext-book-examples,代码行数:18,代码来源:EntitiesQuickfixProvider.java

示例3: createMissingEntity

@Fix(Diagnostic.LINKING_DIAGNOSTIC)
public void createMissingEntity(final Issue issue, IssueResolutionAcceptor acceptor) {
	acceptor.accept(issue,
		"Create missing entity", // label
		"Create missing entity", // description
		"Entity.gif", // icon
		new ISemanticModification() {
			public void apply(EObject element, IModificationContext context) throws BadLocationException {
				 IXtextDocument xtextDocument = context.getXtextDocument();
				 String missingEntityName = xtextDocument.get(issue.getOffset(), issue.getLength());
				 Entity newEntity = EntitiesFactory.eINSTANCE.createEntity();
				 newEntity.setName(missingEntityName);
				 Entity currentEntity = EcoreUtil2.getContainerOfType(element, Entity.class);
				 Model model = (Model) currentEntity.eContainer();
				 model.getEntities().add(model.getEntities().indexOf(currentEntity)+1, newEntity);
			}
		}
	);
}
 
开发者ID:LorenzoBettini,项目名称:packtpub-xtext-book-examples,代码行数:19,代码来源:EntitiesJavaQuickfixProvider.java

示例4: 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);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:12,代码来源:LinkingDiagnosticMessageProvider.java

示例5: getViolatedBoundsConstraintMessage

@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);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:LinkingDiagnosticMessageProvider.java

示例6: getViolatedBoundsConstraintMessage

@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);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:9,代码来源:GamlLinkingErrorMessageProvider.java

示例7: characterUnknown

@Fix(Diagnostic.LINKING_DIAGNOSTIC)
public void characterUnknown(final Issue issue, final IssueResolutionAcceptor acceptor) {
  EClass _characterDefinition = DialogScriptPackage.eINSTANCE.getCharacterDefinition();
  final String linkText = this.customLinkingDiagnosticMessageProvider.getLinkText(issue, _characterDefinition);
  boolean _notEquals = (!Objects.equal(linkText, null));
  if (_notEquals) {
    final ISemanticModification _function = new ISemanticModification() {
      public void apply(final EObject element, final IModificationContext context) throws Exception {
        if ((element instanceof DialogLine)) {
          final Script root = EcoreUtil2.<Script>getContainerOfType(element, Script.class);
          final CharacterDefinition charaDef = DialogScriptFactory.eINSTANCE.createCharacterDefinition();
          charaDef.setName(linkText);
          CharactersDefinition _charactersDefinition = root.getCharactersDefinition();
          boolean _equals = Objects.equal(_charactersDefinition, null);
          if (_equals) {
            CharactersDefinition _createCharactersDefinition = DialogScriptFactory.eINSTANCE.createCharactersDefinition();
            root.setCharactersDefinition(_createCharactersDefinition);
          }
          CharactersDefinition _charactersDefinition_1 = root.getCharactersDefinition();
          EList<CharacterDefinition> _characters = _charactersDefinition_1.getCharacters();
          _characters.add(charaDef);
        }
      }
    };
    acceptor.accept(issue, (("Create character \'" + linkText) + "\'"), (("Create character \'" + linkText) + "\'"), null, _function);
  }
}
 
开发者ID:RobertWalter83,项目名称:DialogScriptDSL,代码行数:27,代码来源:DialogScriptQuickfixProvider.java

示例8: createTemplate

@Fix(Diagnostic.LINKING_DIAGNOSTIC)
public void createTemplate(final Issue issue, final IssueResolutionAcceptor acceptor) {
  EClass _template = CharacterScriptPackage.eINSTANCE.getTemplate();
  final String linkText = this.customLinkingDiagnosticMessageProvider.getLinkText(issue, _template);
  this.addImportTemplateFix(issue, acceptor, linkText);
  this.addLocalTemplateFix(issue, acceptor, linkText);
}
 
开发者ID:RobertWalter83,项目名称:DialogScriptDSL,代码行数:7,代码来源:CharacterScriptQuickfixProvider.java

示例9: getUnresolvedProxyMessage

@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);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:43,代码来源:UnresolvedFeatureCallTypeAwareMessageProvider.java

示例10: getIllegalNodeMessage

@Override
public DiagnosticMessage getIllegalNodeMessage(ILinkingDiagnosticContext context, IllegalNodeException ex) {
	String message = ex.getMessage();
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:LinkingDiagnosticMessageProvider.java

示例11: getIllegalCrossReferenceMessage

@Override
public DiagnosticMessage getIllegalCrossReferenceMessage(ILinkingDiagnosticContext context, CrossReference reference) {
	String message = "Cannot find reference " + reference;
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:LinkingDiagnosticMessageProvider.java

示例12: getViolatedUniqueConstraintMessage

@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);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:LinkingDiagnosticMessageProvider.java

示例13: getUnresolvedProxyMessage

@Override
public DiagnosticMessage getUnresolvedProxyMessage(ILinkingDiagnosticContext context) {
	return new DiagnosticMessage(expected, Severity.WARNING, Diagnostic.LINKING_DIAGNOSTIC);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:LinkingWarningsTest.java

示例14: getIllegalNodeMessage

@Override
public DiagnosticMessage getIllegalNodeMessage(final ILinkingDiagnosticContext context,
		final IllegalNodeException ex) {
	final String message = ex.getMessage();
	return new DiagnosticMessage(message, Severity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:6,代码来源:GamlLinkingErrorMessageProvider.java

示例15: getIllegalCrossReferenceMessage

@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);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:6,代码来源:GamlLinkingErrorMessageProvider.java


注:本文中的org.eclipse.xtext.diagnostics.Diagnostic.LINKING_DIAGNOSTIC属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。