|validation display in TreeMasterDetailSWTRenderer [message #1850734]
||Tue, 15 March 2022 17:34
| Rich Harker
Registered: March 2022
I'm developing an EMF based application which uses EMF 1.26.
As part of our modelled EObjects, we have a number of view models, including a couple that use the TreeMasterDetailSWTRenderer, and am having difficulties getting these to display, and act upon, validation diagnostics as we would like.
Default behaviour of the TreeMasterDetailSWTRenderer seems to be that:
- When a node in the tree is selected, it, and it only, is validated. If it fails validation, the validation diagnostic is then notified to TreeMasterDetailSWTRenderer to allow the UI to display the validation for that node.
- When we then select a different node in the tree, any displayed validation on the previously highlighted node is automatically cleared.
- If we manually instigate validation in our code (by using Diagnostician.INSTANCE.validate(...)) of an EObject which a node in the TreeMasterDetailSWTRenderer treeview represents, then the TreeMasterDetailSWTRenderer is not notified of the validation result.
We would like to make TreeMasterDetailSWTRenderer, or a subclass of it, work such that:
- programatically validating an EObject which a node in the TreeView represents should cause notification to the TreeMasterDetailSWTRenderer TreeView to allow that validation to be displayed.
--> For this, I've looked at the source of TreeMasterDetailSWTRenderer and it's ancestors, but have been unable to figure out what causes it to be notified of validation or not. Can anyone offer any suggestions on how this happens please, i.e. how we can ensure that the TreeMasterDetailSWTRenderer is always notified when any of the EObjects it represents have been validated.
- validation displayed on the tree is displayed indefinitely - i.e. until a validation does not present any issues, regardless of where the user clicks in the displayed tree.
--> To achieve this, I've tried subclassing TreeMasterDetailSWTRenderer and overriding the 'applyValidation(final VDiagnostic oldDia, final VDiagnostic newDia)' method. The issue I'm running into here though is that while is a particular EObject fails validation, we can update the tree, I cannot figure out how to tell if that EObject subseuqently succeeds a later validation - as although in applyValidation(...) we get the old and new diagnostics, if an item does /not/ appear in the new diagnostic, there is no way to tell if it's not in there because (a) validation is now succeeding or (b) it just wasn't validated this time. I should note that in our validation code, the validation methods typically do not add an "OK" validation if validation succeeds - only a "FAIL" (or whatever) if there is a problem... is this approach wrong?
I've searched these forums, the wider internet, and browsed various parts of the source code, but so far am pretty stumped on how to resolve either (1) or (2), so any suggestions anyone can make would be appreciated.
Powered by FUDForum
. Page generated in 0.02642 seconds