live validation [message #28474] |
Mon, 20 March 2006 10:15  |
Eclipse User |
|
|
|
Hi,
I am having trouble in using Live Validation Tutorial for Library model.
I followed steps mentioned in Validation Tutorial which is in GMF doc i.e.
Tutorial: EMF Validation General,Version: 0.1,Date: June 07, 2005
Only thing I can see that I have added adapter in
initializePackageContents method of LibraryPackageImpl i.e.
// Create resource
Resource r = createResource(eNS_URI);
EContentAdapter liveValidationContentAdapter = new
LiveValidationContentAdapter();
r.eAdapters().add(liveValidationContentAdapter);
Though I am not getting any error but it is not executing validate
method of NonEmptyNamesConstraint class.
I am wondering what's wrong or what else need to be done?
Any thoughts?
- Parvez
|
|
|
|
Re: live validation [message #28926 is a reply to message #28474] |
Mon, 20 March 2006 12:06  |
Eclipse User |
|
|
|
Hi Parvez,
The LiveValidationContentAdapter automatically places any object its
validating into a special client context defined in the plugin.xml of
the example (extension point:
org.eclipse.emf.validation.constraintBindings).
Using the static latch in the ValidationDelegateClientSelector class is
not our recommended approach to registering client contexts but it helps
us to show a wide range of client usages of the validation framework for
our example.
The simplest approach to getting your constraint to be invoked would be
to make sure that you have a constraintBinding that binds your
constraint's category (or the single constraint itself) to the client
context that we have defined in the example
(org.eclipse.emf.validation.pde.example.general.ui.libraryCo ntext).
There is an example of such a constraint binding in the example's
plugin.xml.
A more correct approach to this would be to create your own client
context using a selector or an enablement expression and bind your
constraint to your context.
I hope this helps,
Chris McGee
Parvez Chauhan wrote:
> Hi,
>
> I am having trouble in using Live Validation Tutorial for Library model.
>
> I followed steps mentioned in Validation Tutorial which is in GMF doc i.e.
> Tutorial: EMF Validation General,Version: 0.1,Date: June 07, 2005
>
> Only thing I can see that I have added adapter in
> initializePackageContents method of LibraryPackageImpl i.e.
>
> // Create resource
> Resource r = createResource(eNS_URI);
>
> EContentAdapter liveValidationContentAdapter = new
> LiveValidationContentAdapter();
> r.eAdapters().add(liveValidationContentAdapter);
>
> Though I am not getting any error but it is not executing validate
> method of NonEmptyNamesConstraint class.
>
> I am wondering what's wrong or what else need to be done?
> Any thoughts?
>
> - Parvez
|
|
|
Re: live validation [message #572329 is a reply to message #28474] |
Mon, 20 March 2006 10:28  |
Eclipse User |
|
|
|
Just to add further, I didn't make use of batch execution code
(mentioned below) as I think (may be I am wrong) that I don't need to
use it for live validation
ValidationDelegateClientSelector.running = true;
IBatchValidator validator =
(IBatchValidator)ModelValidationService.getInstance()
.newValidator(EvaluationMode.BATCH);
validator.setIncludeLiveConstraints(true);
IStatus status = validator.validate(selectedEObjects);
ValidationDelegateClientSelector.running = false;
- Parvez
Parvez Chauhan wrote:
> Hi,
>
> I am having trouble in using Live Validation Tutorial for Library model.
>
> I followed steps mentioned in Validation Tutorial which is in GMF doc i.e.
> Tutorial: EMF Validation General,Version: 0.1,Date: June 07, 2005
>
> Only thing I can see that I have added adapter in
> initializePackageContents method of LibraryPackageImpl i.e.
>
> // Create resource
> Resource r = createResource(eNS_URI);
>
> EContentAdapter liveValidationContentAdapter = new
> LiveValidationContentAdapter();
> r.eAdapters().add(liveValidationContentAdapter);
>
> Though I am not getting any error but it is not executing validate
> method of NonEmptyNamesConstraint class.
>
> I am wondering what's wrong or what else need to be done?
> Any thoughts?
>
> - Parvez
|
|
|
Re: live validation [message #572346 is a reply to message #28474] |
Mon, 20 March 2006 12:06  |
Eclipse User |
|
|
|
Hi Parvez,
The LiveValidationContentAdapter automatically places any object its
validating into a special client context defined in the plugin.xml of
the example (extension point:
org.eclipse.emf.validation.constraintBindings).
Using the static latch in the ValidationDelegateClientSelector class is
not our recommended approach to registering client contexts but it helps
us to show a wide range of client usages of the validation framework for
our example.
The simplest approach to getting your constraint to be invoked would be
to make sure that you have a constraintBinding that binds your
constraint's category (or the single constraint itself) to the client
context that we have defined in the example
(org.eclipse.emf.validation.pde.example.general.ui.libraryCo ntext).
There is an example of such a constraint binding in the example's
plugin.xml.
A more correct approach to this would be to create your own client
context using a selector or an enablement expression and bind your
constraint to your context.
I hope this helps,
Chris McGee
Parvez Chauhan wrote:
> Hi,
>
> I am having trouble in using Live Validation Tutorial for Library model.
>
> I followed steps mentioned in Validation Tutorial which is in GMF doc i.e.
> Tutorial: EMF Validation General,Version: 0.1,Date: June 07, 2005
>
> Only thing I can see that I have added adapter in
> initializePackageContents method of LibraryPackageImpl i.e.
>
> // Create resource
> Resource r = createResource(eNS_URI);
>
> EContentAdapter liveValidationContentAdapter = new
> LiveValidationContentAdapter();
> r.eAdapters().add(liveValidationContentAdapter);
>
> Though I am not getting any error but it is not executing validate
> method of NonEmptyNamesConstraint class.
>
> I am wondering what's wrong or what else need to be done?
> Any thoughts?
>
> - Parvez
|
|
|
Powered by
FUDForum. Page generated in 0.04183 seconds