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


Java Issue.getLineNumber方法代码示例

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


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

示例1: collectAllResolutions

import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
/**
 * CollectAll resolutions under the cursor at offset.
 *
 */
List<IssueResolution> collectAllResolutions(XtextResource resource, RegionWithCursor offset,
		Multimap<Integer, Issue> offset2issue) {

	EObject script = resource.getContents().get(0);
	ICompositeNode scriptNode = NodeModelUtils.getNode(script);
	ILeafNode offsetNode = NodeModelUtils.findLeafNodeAtOffset(scriptNode, offset.getGlobalCursorOffset());
	int offStartLine = offsetNode.getTotalStartLine();
	List<Issue> allIssues = QuickFixTestHelper.extractAllIssuesInLine(offStartLine, offset2issue);

	List<IssueResolution> resolutions = Lists.newArrayList();

	for (Issue issue : allIssues) {
		if (issue.getLineNumber() == offsetNode.getStartLine()
				&& issue.getLineNumber() <= offsetNode.getEndLine()) {
			Display.getDefault().syncExec(() -> resolutions.addAll(quickfixProvider.getResolutions(issue)));
		}
	}
	return resolutions;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:QuickFixXpectMethod.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.getLineNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。