[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[News.eclipse.technology.gmf] Re: Constraints in Ecore for GMF

Madanagopal,

This doesn't look right.  The Ecore "constraints" annotation should list space separated names for constraints, e.g., "Abc Def", and then in the generated XyzValidator.java you'd fill in the method bodies for enforcing those constraints.  (I imagine you'll want to check that name != null.)  Basic EMF validation can be invoked standalone using Diagnostician.INSTANCE.validate(EObject).
http://www.eclipse.org/emf/docs.php?doc=references/overview/EMF.Validation.html


Madanagopal wrote:
Hello,

With reference to some previous posts  https://bugs.eclipse.org/bugs/show_bug.cgi?id=143580
i am currently trying to have constraints implemented at the Ecore level.

Moreover my requirement is to validate a class Firm with an attribute  "name" with constraint "self.name.size() > 0".

I have another possibility to implement this. Define an Audit Rule for  this constraint and then Enable the Validation Options in .gmfgen by  setting

Diagram -> Validation Decorators  to "true"
Diagram -> Valdation Enabled to "true"
Providers -> Validation Provider Priority  to "Medium".

This will generate diagram plugin which would have options Diagram->  Validate to validate my Model.

Now having constraints at Ecore level, what are the benifits that i get  when i use them for GMF, since I have to deal with lots of Constraints in  Design Level while writing Ecore and some in gmfmap.

Should i still have to make any changes while generating GMF Diagram  Editors with having Constraints in Ecore Level.

Please Post in your Comments.
An Example or a tutorial on this topic would be really helpful.

Madanagopal.

Attachments :
1. Ecore Snapshot
2. Ecore File




GIF image