Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] RCP: Custom validator: no controls highlighting
[EMF Forms] RCP: Custom validator: no controls highlighting [message #1711472] Fri, 16 October 2015 11:03 Go to next message
Klim Tow is currently offline Klim TowFriend
Messages: 49
Registered: September 2015
Member
Hi all

in my RCP application I try to perform validation in the EMF Forms layer using custom validator.
I register the validator like this:

EValidator.Registry.INSTANCE.put(MyPackage.eINSTANCE, new EValidator.Descriptor() {
public EValidator getEValidator() {
return new MyValidator();
}
});

That is the generated validator instance is replaced with the custom (it extends the generated).
The validation goes inside the AdapterImpl.notifyChanged(Notification) like this:

Diagnostician.INSTANCE.validate(eObject, context);

DiagnosticChain gets full of diagnostics, but EMF Forms view does not highlight the affected controls.
These diagnostics get never put into the view model context.

Is there a way to highlight the affected controls in this setup or is this something would never work?

Maybe put the diagnostics into the view model context after validation and re-render the whole view?
If this is the way, then is it possible to re-render only the affected controls instead of the whole view?

[Updated on: Fri, 16 October 2015 15:23]

Report message to a moderator

Re: [EMF Forms] Custom validator: markers not visible [message #1711724 is a reply to message #1711472] Mon, 19 October 2015 12:54 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

EMF Forms picks up the default result of the EMF validation. Have you
seen error markers with the default validations, e.g. if you set a
String attribute to manditory in your Ecore?

Best regards

Jonas


Am 16.10.2015 um 13:03 schrieb Klim Tow:
> Hi all
>
> I try to perform validation in the EMF Forms layer using custom validator.
> I register the validator like this:
>
> EValidator.Registry.INSTANCE.put(MyPackage.eINSTANCE, new
> EValidator.Descriptor() {
> public EValidator getEValidator() {
> return new MyValidator();
> }
> });
>
> That is the generated validator instance is replaced with the custom.
> The validation does and DiagnosticChain is full of children, but EMF
> Forms view shows no markers.
> How is EMF Forms connected to the DiagnosticChain of the rendered model
> object?
> Is there a way to show the markers in this setup or is it something
> would never work?


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Custom validator: markers not visible [message #1711742 is a reply to message #1711724] Mon, 19 October 2015 13:32 Go to previous messageGo to next message
Klim Tow is currently offline Klim TowFriend
Messages: 49
Registered: September 2015
Member
Hi Jonas

sorry I deemed highlighting, not the markers

yes, if the same validator is executed in the standard way, the highlighting is done
only if it is executed from AdapterImpl.notifyChanged() it doesn't happen

Klim

[Updated on: Mon, 19 October 2015 13:33]

Report message to a moderator

Re: [EMF Forms] Custom validator: markers not visible [message #1711828 is a reply to message #1711742] Tue, 20 October 2015 05:24 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Does the validaotr you added implement custom validation rules? If so,
do the contain the EStructualFeatures they affect in the data array of
the resulting diagnostic?

Am 19.10.2015 um 15:32 schrieb Klim Tow:
> Hi Jonas
>
> sorry I deemed highlighting, not the markers
>
> yes, if the same validator is executed in the standard way, the
> highlighting is done
> only if it is executed AdapterImpl.notifyChanged() it doesn't happen
>
> Klim


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Custom validator: markers not visible [message #1711884 is a reply to message #1711828] Tue, 20 October 2015 09:03 Go to previous messageGo to next message
Klim Tow is currently offline Klim TowFriend
Messages: 49
Registered: September 2015
Member
no, for now there are no custom rules, the custom validator just decorates the generated validator. it seems to be a matter of from where the validation is triggered
Re: [EMF Forms] Custom validator: markers not visible [message #1712221 is a reply to message #1711884] Thu, 22 October 2015 08:28 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Klim,
do you have added the view.validation bundle to your run config.
There is a org.eclipse.emf.ecp.view.spi.validation.ValidationService and and impl in the same bundle.
This Validator should be triggered on change and it should use your custom validator to validate the objects.
So you don't have to manually trigger the validation.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Custom validator: markers not visible [message #1712223 is a reply to message #1712221] Thu, 22 October 2015 08:49 Go to previous messageGo to next message
Klim Tow is currently offline Klim TowFriend
Messages: 49
Registered: September 2015
Member
Hi Eugen

yes, the bundle is there. The validation does, this is not the point. The highlighting is not done if validating is triggered from the outside. I want the validation triggered from outside.

[Updated on: Thu, 22 October 2015 10:08]

Report message to a moderator

Re: [EMF Forms] Custom validator: markers not visible [message #1712267 is a reply to message #1712223] Thu, 22 October 2015 13:59 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Klim,
You can retrieve the ValidationService from the ViewModelContext and trigger a validation by hand. This should work then.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Custom validator: markers not visible [message #1712409 is a reply to message #1712223] Fri, 23 October 2015 16:14 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

just for reference:
"EMF Forms - it is not qualified for building e4 RCP applications"
Tha is not true, most users we know of build e4 applications...

Best regards

Jonas


Am 22.10.2015 um 10:49 schrieb Klim Tow:
> Hi Eugen
>
> yes, the bundle is there. The validation does, this is not the point.
> The highlighting is not done if validating is triggered from the
> outside. I want the validation triggered from outside.
>
> But this all is irrelevant now because I cannot use EMF Forms - it is
> not qualified for building e4 RCP applications, which are not modified
> ECP Editors. The required services don't start, and it happens in the e4
> example application MakeItHappens too.
>
> see https://www.eclipse.org/forums/index.php/t/1071285/


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Custom validator: markers not visible [message #1712413 is a reply to message #1712267] Fri, 23 October 2015 18:19 Go to previous message
Klim Tow is currently offline Klim TowFriend
Messages: 49
Registered: September 2015
Member
thanks Eugen

@Jonas: thank you, this peace of text is not true but the whole version is "..it is not qualified for building e4 RCP applications which are not derived from generated ECP editor" or something like that. It is also not true. I thought EMF Forms gets never properly setup in that environment, see https://www.eclipse.org/forums/index.php/t/1071285/
Previous Topic:[EMF Forms] 1.7.1: where is org.eclipse.emfforms.spi.common?
Next Topic:[EEF] View Reference Binding
Goto Forum:
  


Current Time: Fri Mar 29 12:19:04 GMT 2024

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

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

Back to the top