Bug 552715 - [Validation] Validation providers should be given the view model context
Summary: [Validation] Validation providers should be given the view model context
Status: CLOSED FIXED
Alias: None
Product: ECP
Classification: Modeling
Component: Validation (show other bugs)
Version: 1.22.0   Edit
Hardware: All All
: P2 enhancement (vote)
Target Milestone: 1.23.0   Edit
Assignee: Christian Damus CLA
QA Contact: Eugen Neufeld CLA
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2019-11-05 16:56 EST by Christian Damus CLA
Modified: 2019-11-06 16:40 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Damus CLA 2019-11-05 16:56:31 EST
The ValidationService (the view-model service one, not the core one) allows injection of diagnostics via ValidationProviders, including registration of such providers on an extension point.

In my private client application, I need to register a ValidationProvider but this provider needs additional services from the context.  However, the ValidationProvider protocol is only asked to provide a list of diagnostics for an EObject without any other context:

    List<Diagnostic> validate(EObject eObject);

(from Validator in the core).

Even if the view model context could be inferred from the EObject in some cases, in others it may not be inferrable (e.g., if it's an object in the EPackage registry).  And besides, it would be nice for a provider to be called back when it is added to the ValidationService to tell it what the context is, so that it can set up dependencies.
Comment 1 Eclipse Genie CLA 2019-11-05 17:47:35 EST
New Gerrit change created: https://git.eclipse.org/r/152093
Comment 3 Christian Damus CLA 2019-11-06 13:04:44 EST
(In reply to Eclipse Genie from comment #2)
> Gerrit change https://git.eclipse.org/r/152093 was merged to [develop].

This change adds new API to the org.eclipse.emf.ecp.view.spi.validation,ValidationProvider type in the form of default methods that implementors may wish to override to access new context information.
Comment 4 Christian Damus CLA 2019-11-06 16:40:21 EST
Verified in the 1230_201911062218 build.