|
|
|
Re: [VALIDATION] How to customize Messages when loading OCL from file [message #424169 is a reply to message #424156] |
Fri, 17 October 2008 21:34 |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
Hi, Torsten,
See some replies in-line, below.
HTH,
Christian
Torsten Link wrote:
> Hi,
>
> 1.
> I tried out the org.eclipse.validation.examples.ocl
> and adapt this to my project. I like to have the OCL
> Statements in a separate File.
>
> But in the file I found no possibility to give
> a name for the constraint and an own message
> if the constraint failed.
Right, this file just literally follows the OCL concrete syntax for
constraint context definitions (and the OCL constraint expressions,
themselves).
> Do I need to implement an own parser for the text file
> or is there maybe an other solution with an
> external XML File already in place.
There are all the solutions that you care to invent. :-)
You can extend the OCL language with a grammar and parser of your own,
much as the QVTo and UMLX projects have done. Or, you can do some kind
of hybrid approach, in which you parse a text file to extract the OCL
bits and the messages, and use the OCL parser on the OCL bits. Or, you
define an XML file (using EMF, of course) that externally associates
messages with the constraint names.
etc.
> 2. When validating my model via the 'validate'
> menue entry in the generated editor only the selected
> element and its direkt children where validated.
> The validation did not do an deep recursiv validation.
> Is that right?
How do you know that these elements weren't validated? Maybe they just
didn't have problems? If you're using the OCL example, note that
constraints are only applied to elements of a type that conforms to the
constraint's context classifier.
Maybe the tree shows non-contained objects as children? Validation is
recursive (by default) over the EObject containment, not the
presentation in the editor.
As Ed alluded to, you can implement the ITraversalStrategy API to
customize the walking of your objects to implement non-recursive
traversal. Put a breakpoint in the TraversalStrategyManager to see
which traversal implementation is used when you validate.
>
> with kind regards
>
>
> Torsten Link
|
|
|
Powered by
FUDForum. Page generated in 0.03456 seconds