// do inference on the model
model = resource.getContents().get(0);
monitor.worked(1);
// do verification
VerificationEngine verify = new VerificationEngine();
IStatus status;
try {
status = verify.verify(model, new SubProgressMonitor(monitor, 9));
} catch (VerificationException e) {
return errorStatus(e);
}
// check for violation exceptions
if (!verify.getViolations().isEmpty()) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 5 && i < verify.getViolations().size(); i++) {
VerificationViolation violation = verify.getViolations().get(i);
if (i != 0)
buf.append("\n");
buf.append(violation.getMessage())
.append(": ");
for (int j = 0; j < violation.getObjects().size(); j++) {
if (j != 0)
buf.append("; ");
buf.append(IamlBreadcrumb.breadcrumb(violation.getObjects().get(j)));
}
}
if (verify.getViolations().size() > 5) {
// there are more
buf.append("\n(...")
.append(verify.getViolations().size() - 5)
.append(" more)");
}
// return the error
return errorStatus("Verification failed:\n\n" + buf.toString());