本文整理汇总了Java中org.eclipse.xtext.validation.Issue.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Issue.getMessage方法的具体用法?Java Issue.getMessage怎么用?Java Issue.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.validation.Issue
的用法示例。
在下文中一共展示了Issue.getMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFormatModel
import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
/**
* Retrieve the format model associated with a given grammar.
* <p>
* <em>Note</em>: Expected to either be in same folder with the same name (except for the extension) or in the SRC outlet.
* </p>
*
* @param grammar
* the grammar, must not be {@code null}
* @param context
* xpand execution context, must not be {@code null}
* @return the format model, or {@code null} if the resource could not be loaded
* @throws FileNotFoundException
* thrown if the format file could not be found
*/
@SuppressWarnings("PMD.NPathComplexity")
public static FormatConfiguration getFormatModel(final Grammar grammar, final XpandExecutionContext context) throws FileNotFoundException {
Variable resourceUriVariable = context.getVariable("resourceUri");
if (resourceUriVariable == null) {
return null;
}
URI uri = (URI) resourceUriVariable.getValue();
final Resource grammarResource = grammar.eResource();
final ResourceSet resourceSet = grammarResource.getResourceSet();
Resource formatResource = null;
try {
formatResource = resourceSet.getResource(uri, true);
} catch (final ClasspathUriResolutionException e) {
// make another attempt
uri = getDefaultFormatLocation(grammar, context);
try {
formatResource = resourceSet.getResource(uri, true);
} catch (WrappedException e1) {
formatResource = resourceSet.getResource(uri, false);
if (formatResource != null) {
resourceSet.getResources().remove(formatResource);
}
throw new FileNotFoundException(uri.toString()); // NOPMD
}
}
if (formatResource == null) {
throw new FileNotFoundException(uri.toString());
}
final List<Issue> issues = getModelValidator().validate(formatResource, LOG);
for (final Issue issue : issues) {
if (issue.isSyntaxError() || issue.getSeverity() == Severity.ERROR) {
throw new WorkflowInterruptedException("Errors found in " + uri.toString() + ": " + issue.getMessage());
}
}
return formatResource.getContents().size() == 0 ? null : (FormatConfiguration) formatResource.getContents().get(0);
}
示例2: message
import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
/**
* Creates a builder for an issue's message.
*
* @see Issue#getMessage()
*
* @return an instance of {@link StringPropertyMatcher} that can be used to specify the actual expectation
*/
public StringPropertyMatcherBuilder message() {
return new StringPropertyMatcherBuilder(this, "message", (Issue issue) -> issue.getMessage());
}