本文整理汇总了Java中org.eclipse.emf.ecore.resource.Resource.getErrors方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.getErrors方法的具体用法?Java Resource.getErrors怎么用?Java Resource.getErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.ecore.resource.Resource
的用法示例。
在下文中一共展示了Resource.getErrors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLoadingBuiltInTypes
import org.eclipse.emf.ecore.resource.Resource; //导入方法依赖的package包/类
@SuppressWarnings("javadoc")
@Test
public void testLoadingBuiltInTypes() {
BuiltInTypeScope scope = BuiltInTypeScope.get(resourceSet);
IEObjectDescription anyType = scope.getSingleElement(QualifiedName.create("any"));
Assert.assertNotNull(anyType);
String s = "";
for (Resource resource : resourceSet.getResources()) {
if (resource.getErrors().size() > 0) {
for (Diagnostic d : resource.getErrors()) {
s += "\n " + d.getMessage() + " at " + resource.getURI() + ":" + d.getLine();
}
}
}
Assert.assertEquals("Resources definine built-in types must have no error."
, "", s);
}
示例2: invokeInternal
import org.eclipse.emf.ecore.resource.Resource; //导入方法依赖的package包/类
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor,
Issues issues) {
ResourceSet resourceSet = getResourceSet();
// due to some Xcore peculiarity we have to access the IAllContainerState here
// to trigger some lazy init logic
IAllContainersState allContainerState = (IAllContainersState) EcoreUtil.getAdapter(resourceSet.eAdapters(),
IAllContainersState.class);
allContainerState.isEmpty("");
Multimap<String, URI> uris = getPathTraverser().resolvePathes(pathes,
new Predicate<URI>() {
@Override
public boolean apply(URI input) {
return input.fileExtension().equals(XCORE_FILE_EXT);
}
});
List<Resource> resources = new ArrayList<>();
for (URI uri : uris.values()) {
LOGGER.info(uri);
try {
resources.add(parse(uri, resourceSet));
} catch (Exception e) {
LOGGER.error("Problem during loading of resource @ " + uri, e);
}
}
installIndex(resourceSet);
for (Resource r : resources) {
EcoreUtil.resolveAll(r);
for (Diagnostic x : r.getErrors()) {
issues.addError(x.getMessage(), x);
}
}
ctx.set(slot, resources);
}