[Databinding] Bug in AbstractStringToNumberValidator? [message #316657] |
Thu, 14 June 2007 09:39  |
Eclipse User |
|
|
|
Hi,
I'm using the databinding framework to bind SWT controls to POJO Models
in the context of Eclipse forms. I've written glue code which listens to
validation state changes in the binding for the control. If there is a
change I add or remove message which are display in the appropriate form
areas. I'm having a text field which is bound to an int model property.
If I enter letter in the field, a validation error is thrown and the
message in the format:
"Invalid character for value [2c] at position [2] character ²c]"
That's fine. The problem is, that the message never changes after it was
created once. I tracked down the problem to the Validator
" org.eclipse.core.internal.databinding.validation.AbstractStr ingToNumberValidator ".
There is the following code
if (result.getNumber() != null) {
...
}
} else if (result.getPosition() != null) {
if (parseErrorMessage == null) {
parseErrorMessage = StringToNumberParser
..createParseErrorMessage((String) value,
result.getPosition());
}
return ValidationStatus.error(parseErrorMessage);
}
parseErrorMessage is a member of the validator and therefore only
initialized once ;(
I'm also use the UpdateValueStrategy which creates the validators just
once as well. The user get the first created message every time.
Is that a bug or did I something wrong?
Plattform:
Eclipse 3.3m7
Windows XP Prof
JDK 1.5_09
Thanks in advance
Thomas
|
|
|
|
|
|
Re: [Databinding] Bug in AbstractStringToNumberValidator? [message #317129 is a reply to message #317102] |
Tue, 26 June 2007 12:05  |
Eclipse User |
|
|
|
Thanks Brad,
sorry, that I didn't fill in the bug, but I was in vacation :)
Regards
Thomas
Brad Reynolds schrieb:
> Logged bug 194353[1].
>
> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=194353
>
> Brad Reynolds wrote:
>> That's a bug. Can you please log it in bugzilla?
>>
>> -brad
>>
>> Thomas Fahrmeyer wrote:
>>> Has no one experienced this problem? I think that's behaviour is not
>>> the expected one. I mean that only the first validation message will
>>> be tracked and displayed, no matter how many errors occurs later for
>>> the same field.
>>>
>>> Any hint or help is appreciated.
>>> Thomas
>>>
>>>
>>> Thomas Fahrmeyer schrieb:
>>>> Hi,
>>>>
>>>> I'm using the databinding framework to bind SWT controls to POJO
>>>> Models in the context of Eclipse forms. I've written glue code which
>>>> listens to validation state changes in the binding for the control.
>>>> If there is a change I add or remove message which are display in
>>>> the appropriate form areas. I'm having a text field which is bound
>>>> to an int model property. If I enter letter in the field, a
>>>> validation error is thrown and the message in the format:
>>>>
>>>> "Invalid character for value [2c] at position [2] character ²c]"
>>>>
>>>> That's fine. The problem is, that the message never changes after it
>>>> was created once. I tracked down the problem to the Validator
>>>> " org.eclipse.core.internal.databinding.validation.AbstractStr ingToNumberValidator ".
>>>>
>>>>
>>>> There is the following code
>>>>
>>>> if (result.getNumber() != null) {
>>>> ...
>>>> }
>>>> } else if (result.getPosition() != null) {
>>>> if (parseErrorMessage == null) {
>>>> parseErrorMessage = StringToNumberParser
>>>> .createParseErrorMessage((String) value,
>>>> result.getPosition());
>>>> }
>>>>
>>>> return ValidationStatus.error(parseErrorMessage);
>>>> }
>>>>
>>>> parseErrorMessage is a member of the validator and therefore only
>>>> initialized once ;(
>>>>
>>>> I'm also use the UpdateValueStrategy which creates the validators
>>>> just once as well. The user get the first created message every time.
>>>>
>>>> Is that a bug or did I something wrong?
>>>>
>>>> Plattform:
>>>>
>>>> Eclipse 3.3m7
>>>> Windows XP Prof
>>>> JDK 1.5_09
>>>>
>>>> Thanks in advance
>>>> Thomas
|
|
|
Powered by
FUDForum. Page generated in 0.04032 seconds