本文整理汇总了Java中org.eclipse.xtext.validation.Issue.IssueImpl方法的典型用法代码示例。如果您正苦于以下问题:Java Issue.IssueImpl方法的具体用法?Java Issue.IssueImpl怎么用?Java Issue.IssueImpl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.validation.Issue
的用法示例。
在下文中一共展示了Issue.IssueImpl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPostProcessingFailedError
import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
private Issue createPostProcessingFailedError(N4JSResource res, Throwable th) {
final String thKind = th instanceof Error ? "error" : (th instanceof Exception ? "exception" : "throwable");
final String thName = th.getClass().getSimpleName();
final String trace = "\n" + Stream.of(th.getStackTrace())
.map(ste -> ste.toString())
.collect(Collectors.joining("\n")); // cannot add indentation, because Xtext would reformat the message
final String msg = IssueCodes.getMessageForPOST_PROCESSING_FAILED(thKind, thName, th.getMessage() + trace);
final Issue.IssueImpl issue = new Issue.IssueImpl();
issue.setCode(IssueCodes.POST_PROCESSING_FAILED);
issue.setSeverity(IssueCodes.getDefaultSeverity(IssueCodes.POST_PROCESSING_FAILED));
issue.setMessage(msg);
issue.setUriToProblem(EcoreUtil.getURI(res.getScript()));
issue.setType(CheckType.FAST); // using CheckType.FAST is important to get proper marker update behavior in ...
// ... the editor between persisted and dirty states!
issue.setOffset(0);
issue.setLength(0);
issue.setLineNumber(0);
issue.setColumn(0);
return issue;
}
示例2: synthesizeIssuesForFollowUpErrors
import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
protected void synthesizeIssuesForFollowUpErrors(Resource resource, List<Issue> result) {
List<EObject> contents = resource.getContents();
if (!contents.isEmpty()) {
IResolvedTypes resolvedTypes = typeResolver.resolveTypes(contents.get(0));
for(ILinkingCandidate linkingCandidate: resolvedTypes.getFollowUpErrors()) {
XExpression expression = linkingCandidate.getExpression();
IssueImpl issue = new Issue.IssueImpl();
issue.setUriToProblem(EcoreUtil.getURI(linkingCandidate.getExpression()));
if (expression instanceof XAbstractFeatureCall)
issue.setMessage(((XAbstractFeatureCall) expression).getConcreteSyntaxFeatureName() + " cannot be resolved");
else {
List<INode> nodes = NodeModelUtils.findNodesForFeature(expression, XbasePackage.Literals.XCONSTRUCTOR_CALL__CONSTRUCTOR);
if (nodes.size() >= 1) {
issue.setMessage(nodes.get(0).getText() + " cannot be resolved");
}
}
result.add(issue);
}
}
}
示例3: testBugFix322645
import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=322645
*/
@Test public void testBugFix322645() throws Exception {
Issues issues = issues();
Issue a = new Issue.IssueImpl();
Issue b = new Issue.IssueImpl();
issues.addError("foo", a);
issues.addWarning(null, a);
issues.addError(null, b);
MWEDiagnostic[] errors = issues.getErrors();
assertEquals(2, errors.length);
final Validator validator = new Validator();
final String string = validator.toString(issues);
assert(string.contains("foo"));
}
示例4: reportProjectIssue
import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
public void reportProjectIssue(final String message, final String code, final Severity severity) {
Issue.IssueImpl _issueImpl = new Issue.IssueImpl();
final Procedure1<Issue.IssueImpl> _function = (Issue.IssueImpl it) -> {
it.setMessage(message);
it.setCode(code);
it.setSeverity(severity);
it.setUriToProblem(this.baseDir);
};
Issue.IssueImpl _doubleArrow = ObjectExtensions.<Issue.IssueImpl>operator_doubleArrow(_issueImpl, _function);
this.issueAcceptor.apply(this.baseDir, Collections.<Issue>unmodifiableList(CollectionLiterals.<Issue>newArrayList(_doubleArrow)));
}