One option would be to hook into the EMF validation framework using  (without the GMF dependency which indeed makes more sense to be optional - thanks). Another option would be to get hold of your EMF resource and then evaluate a specific EVL file on it as demonstrated in .
I managed to get it working for GEF, so I'll put some notes here for others.
Registering my EVL file in the EMF validation did not cause too much problems using the org.eclipse.epsilon.evl.emf.validation.org.eclipse.epsilon.evl.emf.validation extension.
Finding out how to activate this registered EVL file, was a bigger challenge.
In the end I found out about the Diagnostician class (in emf.ecore.util) and that is it able to 'find' the EVL file and use it for its diagnostics.
I created a AbstractModelConstraint that uses the Diagnostician class for its validation and convert the result into a status:
public class MyConstraint extends AbstractModelConstraint
public IStatus validate(IValidationContext ctx)
Diagnostician diagnostician = new Diagnostician();
Diagnostic diagnostics = diagnostician.validate(ctx.getTarget());
if (diagnostics.getSeverity() == Diagnostic.OK)
return createSuccessReport(ctx, target);
List<Diagnostic> diagnosticsChildren = diagnostics.getChildren();
if (diagnosticsChildren.size() == 1)
Diagnostic child = diagnosticsChildren.get(0);
return createFailureReport(ctx, target, child.getMessage());
// Create multiple failure reports and combine into a multistatus report
List<IStatus> statusList = new ArrayList<IStatus>(diagnosticsChildren.size());
for (Diagnostic child : diagnosticsChildren)
statusList.add(createFailureReport(ctx, target, child.getMessage()));
return ConstraintStatus.createMultiStatus(ctx, statusList);
The constraint can be registered using the org.eclipse.emf.validation.constraintProviders extension and a validation listener can be used to do something with the validation result (eg creating markers)