Model Validation

Issue #186 new
Regent L'Archeveque created an issue

Make use of EMF Validation to check for errors and warnings.

Diagnostic diagnostic = Diagnostician.INSTANCE.validate(...);
if (diagnostic.getSeverity() != Diagnostic.OK){
    Iterator<Diagnostic> diagnostics = diagnostic.getChildren().iterator();         
    while (diagnostics.hasNext()){
    Diagnostic currentDiagnostic = diagnostics.next();              
    if ((currentDiagnostic.getData() != null) && 
        (currentDiagnostic.getData().isEmpty() == false)){                     
                       EObject eObject = (EObject) currentDiagnostic.getData().get(0);

Use Decorator to indicate errors and markers to report problems.

public Image getImage(Object object) {
    Image image = super.getImage(object);
    if (getDiagnosticErrorsMap().containsKey(object)) {
        List<Image> images = new ArrayList<Image>();
        images.add(image);
        images.add(getErrorOverlayImage());
        image = ExtendedImageRegistry.INSTANCE
                .getImage(new ComposedImage(images));
    }
    return image;
}

Comments (0)

  1. Log in to comment