| Validation Service [message #727617] |
Wed, 21 September 2011 12:28  |
Kamesh Sampath Messages: 213 Registered: July 2009 |
Senior Member |
|
|
I have a model where i have choice items as part of the model like name and qname, the qname is captured using two fields and when seralization is done I use custom xml value binding to take value form these fields
Can we have the Validation Service @ the model element level ? so that i can validate either of them is not null ? or any suggestions to do this ?
~Kamesh
|
|
|
| Re: Validation Service [message #727639 is a reply to message #727617] |
Wed, 21 September 2011 14:20   |
Konstantin Komissarchik Messages: 769 Registered: July 2009 |
Senior Member |
|
|
There is an open enhancement request for 0.4 that tracks allowing ValidationService at model element level.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=329076
In this particular case, I would recommend attaching ValidationService to the individual properties as that will give you validation markers on the actual properties. Keep in mind that a ValidationService for a property can reference other properties as part of its validation logic. Just make sure to use @DependsOn annotation to mark the properties that validation is consuming or validation will not refresh when appropriate.
@Service( impl = PropAValidationService.class )
@DependsOn( { "PropB", "PropC" } )
...
@Service( impl = PropBValidationService.class )
@DependsOn( { "PropA", "PropC" } )
...
@Service( impl = PropCValidationService.class )
@DependsOn( { "PropA", "PropB" } )
- Konstantin
[Updated on: Wed, 21 September 2011 14:20] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Validation Service [message #728689 is a reply to message #728683] |
Fri, 23 September 2011 12:41  |
Konstantin Komissarchik Messages: 769 Registered: July 2009 |
Senior Member |
|
|
The general recommendation in resource change listeners is to not spend a lot of time in your event handler as workspace is locked during resource event notification and Eclipse can appear frozen to users. There are many ways to accomplish this beyond asyncExec. For instance, you can start a thread.
On whether it's appropriate to do a refresh of a single property inline, it's subjective. You can try and see if you observe any problems. If I was writing the code, I would be inclined to use a thread to be on the safe side.
- Konstantin
|
|
|
Powered by
FUDForum. Page generated in 0.02687 seconds