4

We are currently using EMF Validation to provide direct feedback to the user in case of model constraint violation.

The system is set up as follows:

  • An EContentAdapter records all modifications done on the model
  • A CommandStackListener pushes these modifications to the EMF Validation framework upon finishing a Command. This reduces the number of validations executed. The EMF LiveValidator is configured to also report SUCCESS.
  • Every constraint looks at the Notification based on the following criteria:
    • Is it a Modification of the contents of the entity being validated?
    • Is it a Modification which adds the entity being validated?
    • Is it a Modification which will influence a previously calculated Validation result in some other way?
  • A ValidationListener keeps a list of all entities that have failed Constraints. It updates this list with the new SUCCESS or FAILED ConstraintStatus messages. It also updates the list to remove FAILED entities that are no longer contained in the Resource (because they were removed).

It seems that I have implemented a lot of functionality myself. Is there no standard API / Implementation available to do the following?

  • Track Validation Status
  • Track the attributes a Constraint uses; only revalidate if one of these attributes change.
    • Comparable to how JFace Databinding's ComputedValue works.

Or am I actually using the framework to the fullest? If I would be using OCL Constraints, would the system then be able to detect which changes impact the Constraint result?

Lii
  • 11,553
  • 8
  • 64
  • 88
parasietje
  • 1,529
  • 8
  • 36

0 Answers0