Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 329076 - Support use of ValidationService at model element level
Summary: Support use of ValidationService at model element level
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2010-10-29 13:44 EDT by Konstantin Komissarchik CLA
Modified: 2021-11-19 09:22 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Komissarchik CLA 2010-10-29 13:44:04 EDT
We currently have a workaround for this issue in Aspen, but logging the issue
so it won't be lost.

Email from Nadeem to Konstantin:
--------------------------------
  I'm noticing that the validate() method only appears to be called on
ModelElementLists (and subsequenly the list's elements) that are rendered in
a table on the UI, but not on the lists that are rendered in the tree via
<node-list>.  I'm trying to figure out if this is something wrong in my code,
or if this is the intended behavior?

  I'm trying to get errors to appear on tree nodes that represent erroneous
customizations in the webservices editor, i.e., a node whose existance is
invalid but none of the node's properties are invalid.  I tried an override
of the validators() method to handle the validation, but the method was never
called.  I also tried adding a validator to the list property using the
Validator annotation, but the validator was was never called.  I thought of
trying to add the @Validator annotation to the IModelElement, but it doesn't
seem like the annotation is valid in that context.

Email response from Konstantin:
-------------------------------
Currently, decorators on nodes in the content outline are limited to
surfacing aggregate validation state of content displayed in sections
attached to the node or to node's children. This is implemented in this way
to account for the fact that you can have multiple nodes covering the same
model element (to break up large model elements) and there might be
properties that you are not showing at all.

In the narrower case of list properties rendered in the content outline, I
think we can safely extend node decorators to take into account validation of
the list property as long as validation was shallow (the list itself, rather
than element properties). I don't think there would be ambiguity as to which
node should show the decoration and I don't think there is ever a case when
you don't want to see it.

Of course, once we add this, it becomes pretty important for us to have
tooltips that show the validation message. Right now, it is only a
nice-to-have item, since the user can drill down and find the original marker
to get more information from.
Comment 1 Konstantin Komissarchik CLA 2011-08-05 16:32:45 EDT
Should investigate this for 0.3.1 release.
Comment 2 Ling Hao CLA 2011-09-12 14:28:21 EDT
I have found a workaround (by adding a filter) for bug 353252 support dynamic list of child element types. Thus I don't have a need for this bug at the 0.3.1 target milestone.
Comment 3 Konstantin Komissarchik CLA 2011-09-13 12:58:40 EDT
I am working on this one right now.
Comment 4 Konstantin Komissarchik CLA 2011-09-14 22:06:31 EDT
Upon further investigation, I have decided to split off the task of displaying validation messages via a tooltip when hovering over a content outline node (now tracked by Bug 357714) from the ability to augment model element's validation at element level independent of properties. 

This bug tracks the latter portion. Note that the original narrative is obsolete as there hasn't been a way to actually override ModelElement's validate method in many releases. The modern approach is to use a validation service. As such, this bug now tracks enabling the use of ValidationService at model element level. Unfortunately, this requires the changes to services API available only in the 0.4 release. Moving the target release accordingly.
Comment 5 Konstantin Komissarchik CLA 2012-06-04 18:00:31 EDT
This one has been done for a while. I just finished cleaning up the sample and the enhancements doc content. For a sample, see DuplicateContactValidationService.

Please verify.
Comment 6 Ling Hao CLA 2012-06-05 13:49:11 EDT
Verified errors appears on tree node.

Reopen bug because duplicate errors shown if more than one errors.

contact.xml
create 1 contact -> fill in all required texts
create another contact -> name is the same as the first contact, leave other empty
Now notice the errors are duplicated in reverse order.
Comment 7 Konstantin Komissarchik CLA 2012-06-05 14:11:50 EDT
Ling,

I am wondering whether this is related or not. Could you check if de-duplication was happening in 0.4?
Comment 8 Ling Hao CLA 2012-06-05 14:19:44 EDT
No duplication in 0.4 - should I open another bug for the regression?
Comment 9 Konstantin Komissarchik CLA 2012-06-05 14:22:44 EDT
If its a regression, then its fine to use this bug to track it.
Comment 10 Konstantin Komissarchik CLA 2012-06-05 20:50:17 EDT
Fixed the regression where duplicate validation messages are shown.
Comment 11 Raj Alagumalai CLA 2012-06-06 03:04:33 EDT
verified on  0.5.0.201206052356
Comment 12 Konstantin Komissarchik CLA 2012-06-06 05:02:45 EDT
Thanks. Closing.