Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » validation display in TreeMasterDetailSWTRenderer (TreeMasterDetailSWTRenderer validation)
validation display in TreeMasterDetailSWTRenderer [message #1850734] Tue, 15 March 2022 17:34 Go to next message
Rich Harker is currently offline Rich HarkerFriend
Messages: 2
Registered: March 2022
Junior Member
Hi All.

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:


  1. 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.
  2. 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.

Many thanks.

Cheers, Rich.
Re: validation display in TreeMasterDetailSWTRenderer [message #1850751 is a reply to message #1850734] Wed, 16 March 2022 05:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

When you invoke Diagnostician.INSTANCE.validate(...) it returns a (parent) Diagnostic whose children contain all the diagnostics. You may use these to notify your TreeMasterDetailSWTRenderer as you find appropriate.

Regards

Ed Willink
Re: validation display in TreeMasterDetailSWTRenderer [message #1850906 is a reply to message #1850751] Mon, 21 March 2022 20:18 Go to previous messageGo to next message
Rich Harker is currently offline Rich HarkerFriend
Messages: 2
Registered: March 2022
Junior Member
Hi Ed.

Thanks for the reply. Raising notifications manually is not something I've tried in EMF before, but I'll take a look at how to do that.

Cheers, Rich.
Re: validation display in TreeMasterDetailSWTRenderer [message #1850910 is a reply to message #1850906] Tue, 22 March 2022 05:47 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I didn't necessarily mean eNotify() which is normally used for changes.

A validation is not a change so re-use of eNotify() might not be appropriate; you certainly risk notifying many irrelevant recipients.

Your validation 'notification' seems like it should be simple. I recommend writing some simple code rather than using a sledgehammer to crack a nut.

Regards

Ed Willink
Previous Topic:Class Diagram for CAPELLA?
Next Topic:Compile stand-alone Java application containing JET-Templates outside of eclipse GUI
Goto Forum:
  


Current Time: Fri Mar 29 00:19:58 GMT 2024

Powered by FUDForum. Page generated in 0.02301 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top