本文整理汇总了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;
}
示例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);
}