blob: 8239689c4a79466087a088400c3a2618cec8b745 [file] [log] [blame]
// Copied from org.eclipse.ocl.examples.test.xtext.PivotDocumentationExamples.java
// Register an extended EValidator for the Complete OCL document constraints
CompleteOCLEObjectValidator myValidator = new CompleteOCLEObjectValidator(
EXTLibraryPackage.eINSTANCE, uri, ocl.getEnvironmentFactory());
EValidator.Registry.INSTANCE.put(EXTLibraryPackage.eINSTANCE, myValidator);
// Validate the entire Resource containing the library
Resource resource = library.eResource();
MyDiagnostician diagnostician = new MyDiagnostician();
Diagnostic diagnostics = diagnostician.validate(resource);
// Print the diagnostics
if (diagnostics.getSeverity() != Diagnostic.OK) {
String formattedDiagnostics = PivotUtil.formatDiagnostics(diagnostics, "\n");
debugPrintf("Validation: %s\n", formattedDiagnostics);
}