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


Java Issue.getLength方法代码示例

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


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

示例1: arreglarNombre

import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
@Fix(RestauranteValidator.NOMBRE_MUY_LARGO)
public void arreglarNombre(final Issue issue, final IssueResolutionAcceptor acceptor) {
  final IModification _function = (IModificationContext context) -> {
    final IXtextDocument xtextDocument = context.getXtextDocument();
    final String nombreActual = xtextDocument.get((issue.getOffset()).intValue(), (issue.getLength()).intValue());
    Integer _offset = issue.getOffset();
    Integer _length = issue.getLength();
    String _substring = nombreActual.substring(0, 18);
    String _plus = (_substring + "\'");
    xtextDocument.replace((_offset).intValue(), (_length).intValue(), _plus);
  };
  acceptor.accept(issue, "Reducir nombre", "Se limitar� el tama�o de nombre al m�ximo sugerido", "ingrediente.ico", _function);
}
 
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:14,代码来源:RestauranteQuickfixProvider.java

示例2: toDiagnostic

import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
private Diagnostic toDiagnostic(final Issue issue) {
  Diagnostic _diagnostic = new Diagnostic();
  final Procedure1<Diagnostic> _function = (Diagnostic it) -> {
    it.setCode(issue.getCode());
    DiagnosticSeverity _switchResult = null;
    Severity _severity = issue.getSeverity();
    if (_severity != null) {
      switch (_severity) {
        case ERROR:
          _switchResult = DiagnosticSeverity.Error;
          break;
        case WARNING:
          _switchResult = DiagnosticSeverity.Warning;
          break;
        case INFO:
          _switchResult = DiagnosticSeverity.Information;
          break;
        default:
          _switchResult = DiagnosticSeverity.Hint;
          break;
      }
    } else {
      _switchResult = DiagnosticSeverity.Hint;
    }
    it.setSeverity(_switchResult);
    it.setMessage(issue.getMessage());
    Integer _elvis = null;
    Integer _lineNumber = issue.getLineNumber();
    if (_lineNumber != null) {
      _elvis = _lineNumber;
    } else {
      _elvis = Integer.valueOf(1);
    }
    final int lineNumber = ((_elvis).intValue() - 1);
    Integer _elvis_1 = null;
    Integer _column = issue.getColumn();
    if (_column != null) {
      _elvis_1 = _column;
    } else {
      _elvis_1 = Integer.valueOf(1);
    }
    final int column = ((_elvis_1).intValue() - 1);
    Integer _elvis_2 = null;
    Integer _length = issue.getLength();
    if (_length != null) {
      _elvis_2 = _length;
    } else {
      _elvis_2 = Integer.valueOf(0);
    }
    final Integer length = _elvis_2;
    Position _position = new Position(lineNumber, column);
    Position _position_1 = new Position(lineNumber, (column + (length).intValue()));
    Range _range = new Range(_position, _position_1);
    it.setRange(_range);
  };
  return ObjectExtensions.<Diagnostic>operator_doubleArrow(_diagnostic, _function);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:58,代码来源:LanguageServerImpl.java


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