Home » Modeling » EMF » Validation Framework
|
Re: Validation Framework [message #427149 is a reply to message #427146] |
Wed, 04 February 2009 12:20 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------040000090402010107030507
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Matthias,
Comments below.
Matthias wrote:
> Hi,
>
> at the moment I try to work with the validation framework. I tried the
> example from the tutorial and the EMF book.
>
> But I have some problems to understand how to go into this:
>
> if (diagnostics != null){
>
> when we always call the function like this:
>
> validator.validateItem_limitExceeded(eObject, null, null);
>
> And diagnostics is always null!
The validator returns true or false to indicate if something is valid.
*Optionally *it can also collect diagnostics describing the reason
something isn't valid. But in many cases, one isn't interested in the
reason, which typically is only useful to the human reader, so the
generated patterns are written to avoid producing diagnostics when they
aren't desired.
>
>
> And if I try to recreate everything with a new ecore model eclipse
> doesn't create the packageValidator.java And it doesn't create the
> code like in the example.
Did you put any constraints in your model? If there are no constraints,
there won't be a generated validator.
> Thank you for your help. I am really frustrated...
>
> Matthias
>
>
--------------040000090402010107030507
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthias,<br>
<br>
Comments below.<br>
<br>
Matthias wrote:
<blockquote
cite="mid:c7e250c114a0a82335a2129e3e1e9718$1@www.eclipse.org"
type="cite">Hi,
<br>
<br>
at the moment I try to work with the validation framework. I tried the
example from the tutorial and the EMF book.
<br>
<br>
But I have some problems to understand how to go into this:
<br>
<br>
if (diagnostics != null){
<br>
<br>
when we always call the function like this:
<br>
<br>
validator.validateItem_limitExceeded(eObject, null, null);
<br>
<br>
And diagnostics is always null!
<br>
</blockquote>
The validator returns true or false to indicate if something is valid.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Validation Framework [message #427150 is a reply to message #427149] |
Wed, 04 February 2009 12:48 |
Matthias Messages: 19 Registered: July 2009 |
Junior Member |
|
|
Hi Ed,
thanks first! ;-)
> The validator returns true or false to indicate if something is valid.
> *Optionally *it can also collect diagnostics describing the reason
> something isn't valid. But in many cases, one isn't interested in the
> reason, which typically is only useful to the human reader, so the
> generated patterns are written to avoid producing diagnostics when they
> aren't desired.
But for output of the errors in the problems view I need this diagnostics,
or?
So how I can get the handle of the DiagnosticChain to add the errors like
in the example?
And about the other problem, I thought if I have a already modeled ecore
model, I just have to add Annotation with Source Ecore. And this is the
constraint. But now I am confused about this.
And I changed this to:
@model annotation="http://www.eclipse.org/emf/2002/Ecore
constraints='limitReached'"
Matthias
Ed Merks wrote:
> Matthias,
> Comments below.
> Matthias wrote:
>> Hi,
>>
>> at the moment I try to work with the validation framework. I tried the
>> example from the tutorial and the EMF book.
>>
>> But I have some problems to understand how to go into this:
>>
>> if (diagnostics != null){
>>
>> when we always call the function like this:
>>
>> validator.validateItem_limitExceeded(eObject, null, null);
>>
>> And diagnostics is always null!
> The validator returns true or false to indicate if something is valid.
> *Optionally *it can also collect diagnostics describing the reason
> something isn't valid. But in many cases, one isn't interested in the
> reason, which typically is only useful to the human reader, so the
> generated patterns are written to avoid producing diagnostics when they
> aren't desired.
>>
>>
>> And if I try to recreate everything with a new ecore model eclipse
>> doesn't create the packageValidator.java And it doesn't create the
>> code like in the example.
> Did you put any constraints in your model? If there are no constraints,
> there won't be a generated validator.
>> Thank you for your help. I am really frustrated...
>>
>> Matthias
>>
>>
|
|
|
Re: Validation Framework [message #427151 is a reply to message #427150] |
Wed, 04 February 2009 12:59 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Matthias,
Comments below.
Matthias wrote:
> Hi Ed,
>
> thanks first! ;-)
>
>> The validator returns true or false to indicate if something is
>> valid. *Optionally *it can also collect diagnostics describing the
>> reason something isn't valid. But in many cases, one isn't
>> interested in the reason, which typically is only useful to the human
>> reader, so the generated patterns are written to avoid producing
>> diagnostics when they aren't desired.
>
> But for output of the errors in the problems view I need this
> diagnostics, or?
Yes.
> So how I can get the handle of the DiagnosticChain to add the errors
> like in the example?
Perhaps you'd like to be more specific so I know what you're referring
to... It's up to the caller to decide to pass in something to collect
diagnostics. As the implementer of a validator, you have to handle the
case where it's null and the case where it's not.
>
> And about the other problem, I thought if I have a already modeled
> ecore model, I just have to add Annotation with Source Ecore. And this
> is the constraint. But now I am confused about this.
>
> And I changed this to:
>
> @model annotation="http://www.eclipse.org/emf/2002/Ecore
> constraints='limitReached'"
It looks right. You reloaded your model so that this actually ended up
in your *.ecore?
>
>
>
> Matthias
>
> Ed Merks wrote:
>
>> Matthias,
>
>> Comments below.
>
>> Matthias wrote:
>>> Hi,
>>>
>>> at the moment I try to work with the validation framework. I tried
>>> the example from the tutorial and the EMF book.
>>>
>>> But I have some problems to understand how to go into this:
>>>
>>> if (diagnostics != null){
>>>
>>> when we always call the function like this:
>>>
>>> validator.validateItem_limitExceeded(eObject, null, null);
>>>
>>> And diagnostics is always null!
>> The validator returns true or false to indicate if something is
>> valid. *Optionally *it can also collect diagnostics describing the
>> reason something isn't valid. But in many cases, one isn't
>> interested in the reason, which typically is only useful to the human
>> reader, so the generated patterns are written to avoid producing
>> diagnostics when they aren't desired.
>>>
>>>
>>> And if I try to recreate everything with a new ecore model eclipse
>>> doesn't create the packageValidator.java And it doesn't create the
>>> code like in the example.
>> Did you put any constraints in your model? If there are no
>> constraints, there won't be a generated validator.
>>> Thank you for your help. I am really frustrated...
>>>
>>> Matthias
>>>
>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: Validation Framework [message #427154 is a reply to message #427151] |
Wed, 04 February 2009 13:42 |
Matthias Messages: 19 Registered: July 2009 |
Junior Member |
|
|
Hi Ed,
> It looks right. You reloaded your model so that this actually ended up
> in your *.ecore?
This was the problem, the changes wasn't in the ecore model itself.
Now it works, thanks a lot.
Matthias
Ed Merks wrote:
> Matthias,
> Comments below.
> Matthias wrote:
>> Hi Ed,
>>
>> thanks first! ;-)
>>
>>> The validator returns true or false to indicate if something is
>>> valid. *Optionally *it can also collect diagnostics describing the
>>> reason something isn't valid. But in many cases, one isn't
>>> interested in the reason, which typically is only useful to the human
>>> reader, so the generated patterns are written to avoid producing
>>> diagnostics when they aren't desired.
>>
>> But for output of the errors in the problems view I need this
>> diagnostics, or?
> Yes.
>> So how I can get the handle of the DiagnosticChain to add the errors
>> like in the example?
> Perhaps you'd like to be more specific so I know what you're referring
> to... It's up to the caller to decide to pass in something to collect
> diagnostics. As the implementer of a validator, you have to handle the
> case where it's null and the case where it's not.
>>
>> And about the other problem, I thought if I have a already modeled
>> ecore model, I just have to add Annotation with Source Ecore. And this
>> is the constraint. But now I am confused about this.
>>
>> And I changed this to:
>>
>> @model annotation="http://www.eclipse.org/emf/2002/Ecore
>> constraints='limitReached'"
> It looks right. You reloaded your model so that this actually ended up
> in your *.ecore?
>>
>>
>>
>> Matthias
>>
>> Ed Merks wrote:
>>
>>> Matthias,
>>
>>> Comments below.
>>
>>> Matthias wrote:
>>>> Hi,
>>>>
>>>> at the moment I try to work with the validation framework. I tried
>>>> the example from the tutorial and the EMF book.
>>>>
>>>> But I have some problems to understand how to go into this:
>>>>
>>>> if (diagnostics != null){
>>>>
>>>> when we always call the function like this:
>>>>
>>>> validator.validateItem_limitExceeded(eObject, null, null);
>>>>
>>>> And diagnostics is always null!
>>> The validator returns true or false to indicate if something is
>>> valid. *Optionally *it can also collect diagnostics describing the
>>> reason something isn't valid. But in many cases, one isn't
>>> interested in the reason, which typically is only useful to the human
>>> reader, so the generated patterns are written to avoid producing
>>> diagnostics when they aren't desired.
>>>>
>>>>
>>>> And if I try to recreate everything with a new ecore model eclipse
>>>> doesn't create the packageValidator.java And it doesn't create the
>>>> code like in the example.
>>> Did you put any constraints in your model? If there are no
>>> constraints, there won't be a generated validator.
>>>> Thank you for your help. I am really frustrated...
>>>>
>>>> Matthias
>>>>
>>>>
>>
>>
|
|
|
Re: Validation Framework [message #427155 is a reply to message #427154] |
Wed, 04 February 2009 14:14 |
Matthias Messages: 19 Registered: July 2009 |
Junior Member |
|
|
The only question no is how to start the validation with a button.
I have a button as a extension and I can run my own classes with this
button, but not the validation process "validateAction".
Any ideas?
Thanks
Matthias
Matthias wrote:
> Hi Ed,
>> It looks right. You reloaded your model so that this actually ended up
>> in your *.ecore?
> This was the problem, the changes wasn't in the ecore model itself.
> Now it works, thanks a lot.
> Matthias
> Ed Merks wrote:
>> Matthias,
>> Comments below.
>> Matthias wrote:
>>> Hi Ed,
>>>
>>> thanks first! ;-)
>>>
>>>> The validator returns true or false to indicate if something is
>>>> valid. *Optionally *it can also collect diagnostics describing the
>>>> reason something isn't valid. But in many cases, one isn't
>>>> interested in the reason, which typically is only useful to the human
>>>> reader, so the generated patterns are written to avoid producing
>>>> diagnostics when they aren't desired.
>>>
>>> But for output of the errors in the problems view I need this
>>> diagnostics, or?
>> Yes.
>>> So how I can get the handle of the DiagnosticChain to add the errors
>>> like in the example?
>> Perhaps you'd like to be more specific so I know what you're referring
>> to... It's up to the caller to decide to pass in something to collect
>> diagnostics. As the implementer of a validator, you have to handle the
>> case where it's null and the case where it's not.
>>>
>>> And about the other problem, I thought if I have a already modeled
>>> ecore model, I just have to add Annotation with Source Ecore. And this
>>> is the constraint. But now I am confused about this.
>>>
>>> And I changed this to:
>>>
>>> @model annotation="http://www.eclipse.org/emf/2002/Ecore
>>> constraints='limitReached'"
>> It looks right. You reloaded your model so that this actually ended up
>> in your *.ecore?
>>>
>>>
>>>
>>> Matthias
>>>
>>> Ed Merks wrote:
>>>
>>>> Matthias,
>>>
>>>> Comments below.
>>>
>>>> Matthias wrote:
>>>>> Hi,
>>>>>
>>>>> at the moment I try to work with the validation framework. I tried
>>>>> the example from the tutorial and the EMF book.
>>>>>
>>>>> But I have some problems to understand how to go into this:
>>>>>
>>>>> if (diagnostics != null){
>>>>>
>>>>> when we always call the function like this:
>>>>>
>>>>> validator.validateItem_limitExceeded(eObject, null, null);
>>>>>
>>>>> And diagnostics is always null!
>>>> The validator returns true or false to indicate if something is
>>>> valid. *Optionally *it can also collect diagnostics describing the
>>>> reason something isn't valid. But in many cases, one isn't
>>>> interested in the reason, which typically is only useful to the human
>>>> reader, so the generated patterns are written to avoid producing
>>>> diagnostics when they aren't desired.
>>>>>
>>>>>
>>>>> And if I try to recreate everything with a new ecore model eclipse
>>>>> doesn't create the packageValidator.java And it doesn't create the
>>>>> code like in the example.
>>>> Did you put any constraints in your model? If there are no
>>>> constraints, there won't be a generated validator.
>>>>> Thank you for your help. I am really frustrated...
>>>>>
>>>>> Matthias
>>>>>
>>>>>
>>>
>>>
|
|
|
Re: Validation Framework [message #427156 is a reply to message #427155] |
Wed, 04 February 2009 14:23 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Matthias,
It's done by ValidateAction. (Ctrl-Shift-T is very handy if you aren't
using it yet.)
Matthias wrote:
> The only question no is how to start the validation with a button.
>
> I have a button as a extension and I can run my own classes with this
> button, but not the validation process "validateAction".
>
> Any ideas?
>
> Thanks
> Matthias
>
> Matthias wrote:
>
>> Hi Ed,
>
>>> It looks right. You reloaded your model so that this actually ended
>>> up in your *.ecore?
>> This was the problem, the changes wasn't in the ecore model itself.
>
>> Now it works, thanks a lot.
>
>> Matthias
>
>> Ed Merks wrote:
>
>>> Matthias,
>
>>> Comments below.
>
>>> Matthias wrote:
>>>> Hi Ed,
>>>>
>>>> thanks first! ;-)
>>>>
>>>>> The validator returns true or false to indicate if something is
>>>>> valid. *Optionally *it can also collect diagnostics describing
>>>>> the reason something isn't valid. But in many cases, one isn't
>>>>> interested in the reason, which typically is only useful to the
>>>>> human reader, so the generated patterns are written to avoid
>>>>> producing diagnostics when they aren't desired.
>>>>
>>>> But for output of the errors in the problems view I need this
>>>> diagnostics, or?
>>> Yes.
>>>> So how I can get the handle of the DiagnosticChain to add the
>>>> errors like in the example?
>>> Perhaps you'd like to be more specific so I know what you're
>>> referring to... It's up to the caller to decide to pass in
>>> something to collect diagnostics. As the implementer of a
>>> validator, you have to handle the case where it's null and the case
>>> where it's not.
>>>>
>>>> And about the other problem, I thought if I have a already modeled
>>>> ecore model, I just have to add Annotation with Source Ecore. And
>>>> this is the constraint. But now I am confused about this.
>>>>
>>>> And I changed this to:
>>>>
>>>> @model annotation="http://www.eclipse.org/emf/2002/Ecore
>>>> constraints='limitReached'"
>>> It looks right. You reloaded your model so that this actually ended
>>> up in your *.ecore?
>>>>
>>>>
>>>>
>>>> Matthias
>>>>
>>>> Ed Merks wrote:
>>>>
>>>>> Matthias,
>>>>
>>>>> Comments below.
>>>>
>>>>> Matthias wrote:
>>>>>> Hi,
>>>>>>
>>>>>> at the moment I try to work with the validation framework. I
>>>>>> tried the example from the tutorial and the EMF book.
>>>>>>
>>>>>> But I have some problems to understand how to go into this:
>>>>>>
>>>>>> if (diagnostics != null){
>>>>>>
>>>>>> when we always call the function like this:
>>>>>>
>>>>>> validator.validateItem_limitExceeded(eObject, null, null);
>>>>>>
>>>>>> And diagnostics is always null!
>>>>> The validator returns true or false to indicate if something is
>>>>> valid. *Optionally *it can also collect diagnostics describing
>>>>> the reason something isn't valid. But in many cases, one isn't
>>>>> interested in the reason, which typically is only useful to the
>>>>> human reader, so the generated patterns are written to avoid
>>>>> producing diagnostics when they aren't desired.
>>>>>>
>>>>>>
>>>>>> And if I try to recreate everything with a new ecore model
>>>>>> eclipse doesn't create the packageValidator.java And it doesn't
>>>>>> create the code like in the example.
>>>>> Did you put any constraints in your model? If there are no
>>>>> constraints, there won't be a generated validator.
>>>>>> Thank you for your help. I am really frustrated...
>>>>>>
>>>>>> Matthias
>>>>>>
>>>>>>
>>>>
>>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Tue Apr 23 10:23:57 GMT 2024
Powered by FUDForum. Page generated in 0.03770 seconds
|