Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » live validation
live validation [message #28474] Mon, 20 March 2006 15:15 Go to next message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
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 #28498 is a reply to message #28474] Mon, 20 March 2006 15:28 Go to previous messageGo to next message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
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 #28926 is a reply to message #28474] Mon, 20 March 2006 17:06 Go to previous message
Chris McGee is currently offline Chris McGeeFriend
Messages: 99
Registered: July 2009
Member
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 15:28 Go to previous message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
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 17:06 Go to previous message
Chris McGee is currently offline Chris McGeeFriend
Messages: 99
Registered: July 2009
Member
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
Previous Topic:live validation
Next Topic:[Announce] EMFT OCL 1.0.0 I200603230819 is available
Goto Forum:
  


Current Time: Thu Apr 25 14:47:10 GMT 2024

Powered by FUDForum. Page generated in 0.03000 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top