Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » EMFForms Validation using Complete OCL(How can OCL rules be used with EMForms?)
EMFForms Validation using Complete OCL [message #1692187] |
Tue, 14 April 2015 04:33  |
Eclipse User |
|
|
|
Hi,
I haven't been able to find a tutorial on using validation rules defined in Complete OCL with EMFForms. Can OCL be used with EMFForms?
I have a small application showing a tree editor generated by EMF and a forms view generated by EMFForms. Since my application loads the OCL bundles, the tree editor's context menu allows me to load an OCL document and to trigger a validation such that I can see the validation markers on the tree items. Unfortunately, no markers appear on the form elements.
Do I need to trigger the validator separately for the form view in this example?
Thanks,
Uwe
|
|
| | | | | | |
Re: EMFForms Validation using Complete OCL [message #1692428 is a reply to message #1692415] |
Wed, 15 April 2015 11:45   |
Eclipse User |
|
|
|
Hi
In my development workspace:
On 15/04/2015 15:14, Uwe San wrote:
> Hi Ed and Jonas,
>
> here are the steps for reproduction:
>
> Import the four projects contained in the zip file into your Eclipse
> workspace.
> Open the SampleApp.product file in the oclemfforms.sampleapp project.
> Click on the "Launch an Eclipse application" link to run the sample
> application.
java.lang.RuntimeException: No application id has been found.
at
org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
at
org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
On 15/04/2015 15:14, Uwe San wrote:
> Hi Ed and Jonas,
>
> here are the steps for reproduction:
>
> Import the four projects contained in the zip file into your Eclipse
> workspace.
> Open the SampleApp.product file in the oclemfforms.sampleapp project.
> Click on the "Launch an Eclipse application" link to run the sample
> application.
> Once the application is showing up, right-click in the Project
> Explorer and choose "New -> Project..."
> In the wizard, choose "General -> Project" and click on "Next".
> Enter any project name and click on "Finish" to close the wizard.
> Drag and drop the files My.sample and Sample.ocl from the resources
> directory of the oclemfforms.sampleapp project into the project you
> just created in the sample application.
> In the Project Explorer, double-click on the My.sample file. An editor
> should show up containing one object of type Element. Note that this
> object's description attribute is empty. You can see that by opening
> the "Enhanced Properties" view in the stacked view below the editor.
> Right-click on the Element object and choose "OCL -> Load Document"
> from the context menu.
> In the dialog, click on the "Browse Workspace..." button and pick the
> Sample.ocl file contained in the project you created in step 6.
> Right-click on the Element object again and choose "Validate" from the
> context menu. A validation should be triggered such that the Element
> object is decorated by a warning marker in the tree view.
> Look at the "Enhanced Properties" view and observe that there are no
> markers on any UI elements.
>
>
> I hope these instructions will help you reproduce my problem. Let me
> know if you have any questions.
>
> Thanks,
> Uwe
|
|
|
Re: EMFForms Validation using Complete OCL [message #1692429 is a reply to message #1692428] |
Wed, 15 April 2015 12:09   |
Eclipse User |
|
|
|
Hi
Just spotted a Console Log full of errors.
You seem to require me to install all sorts of things I don't use.
m2e, jem, wst,
Please provide a more relevant example.
Regards
Ed Willink
On 15/04/2015 16:45, Ed Willink wrote:
> Hi
>
> In my development workspace:
>
>
> On 15/04/2015 15:14, Uwe San wrote:
>> Hi Ed and Jonas,
>>
>> here are the steps for reproduction:
>>
>> Import the four projects contained in the zip file into your Eclipse
>> workspace.
>> Open the SampleApp.product file in the oclemfforms.sampleapp project.
>> Click on the "Launch an Eclipse application" link to run the sample
>> application.
> java.lang.RuntimeException: No application id has been found.
> at
> org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
> at
> org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:497)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
>
> On 15/04/2015 15:14, Uwe San wrote:
>> Hi Ed and Jonas,
>>
>> here are the steps for reproduction:
>>
>> Import the four projects contained in the zip file into your Eclipse
>> workspace.
>> Open the SampleApp.product file in the oclemfforms.sampleapp project.
>> Click on the "Launch an Eclipse application" link to run the sample
>> application.
>> Once the application is showing up, right-click in the Project
>> Explorer and choose "New -> Project..."
>> In the wizard, choose "General -> Project" and click on "Next".
>> Enter any project name and click on "Finish" to close the wizard.
>> Drag and drop the files My.sample and Sample.ocl from the resources
>> directory of the oclemfforms.sampleapp project into the project you
>> just created in the sample application.
>> In the Project Explorer, double-click on the My.sample file. An
>> editor should show up containing one object of type Element. Note
>> that this object's description attribute is empty. You can see that
>> by opening the "Enhanced Properties" view in the stacked view below
>> the editor.
>> Right-click on the Element object and choose "OCL -> Load Document"
>> from the context menu.
>> In the dialog, click on the "Browse Workspace..." button and pick the
>> Sample.ocl file contained in the project you created in step 6.
>> Right-click on the Element object again and choose "Validate" from
>> the context menu. A validation should be triggered such that the
>> Element object is decorated by a warning marker in the tree view.
>> Look at the "Enhanced Properties" view and observe that there are no
>> markers on any UI elements.
>>
>>
>> I hope these instructions will help you reproduce my problem. Let me
>> know if you have any questions.
>>
>> Thanks,
>> Uwe
>
|
|
| | | | |
Re: EMFForms Validation using Complete OCL [message #1692838 is a reply to message #1692411] |
Mon, 20 April 2015 03:19   |
Eclipse User |
|
|
|
Hi Ed,
to make sure we are talking about the same thing:
In the sample integration Uwe provided, if we call
Diagnostician.validate(anyEObject), will the returned Diagnostic contain
constraint violations triggered by OCL rules?
Best regards
Jonas
Am 15.04.2015 um 15:52 schrieb Ed Willink:
> Hi
>
> I think we're both 'standard', but without seeing a live example or even
> a screenshot, I have no idea what is actually being reported.
>
> My guess is that perhaps the EMF Forms knows where diagnostics occur and
> so fails to spot those that appear from elsewhere into the Resource.errors.
>
> Regards
>
> Ed Willink
>
>
>
> On 15/04/2015 14:27, Jonas Helming wrote:
>> Hi,
>>
>> I am not really familiar with the OCL integration here. EMF Forms uses
>> the default EMF validation mechnism. Does OCL push its results into it
>> or is the integration with the tree a custom extension?
>>
>> Best regards
>>
>> Jonas
>>
>> Am 15.04.2015 um 12:57 schrieb Uwe San:
>>> Hi,
>>>
>>> thanks for your reply.
>>>
>>> Running OCL->Validate did not have any effect.
>>>
>>> Please find a full example in the attached zip file. You can run the
>>> sample application contained in the oclemfforms.sampleapp project,
>>> create a new project and a new Sample model element using the wizards.
>>>
>>> There is an OCL file in the resources directory of the
>>> oclemfforms.sampleapp project which you can load into the application
>>> in order to test the validation mechanism. You should see a warning
>>> marker on a model element with an empty description attribute. Note
>>> that there is no marker in either of the two for editors.
>>>
>>> Thanks for your assistance. I'd appreciate your feedback.
>>>
>>> Regards,
>>> Uwe
>>>
>>
>
--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Re: EMFForms Validation using Complete OCL [message #1693041 is a reply to message #1692502] |
Tue, 21 April 2015 07:52   |
Eclipse User |
|
|
|
Hi Uwe,
I can have a look, but could you kindly update the sample code based on
Ed Feedback, so I do not spend much time on dealing with set-up issues?
Best regards
Jonas
Am 16.04.2015 um 11:36 schrieb Uwe San:
> Hi Ed,
>
> thanks for taking the time to analyse the problem. It seems like the
> problem is not on the OCL side so I hope someone from the EMFForms team
> will comment on this issue.
>
> I don't think it's just a missing icon because as far as I know the
> EMFForms validation marker icon is different from the icon used in the
> problems view and the generated form shows validation errors by painting
> text fields red etc., none of which I can see in my application. It
> might be a question of updating the form, though, because as you can
> see, the standard Eclipse Properties view does not show any validation
> markers either.
>
> Thanks,
> Uwe
--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
| | | | |
Re: EMFForms Validation using Complete OCL [message #1693446 is a reply to message #1693439] |
Fri, 24 April 2015 05:52   |
Eclipse User |
|
|
|
Hi
Your diagnosis seems extremely plausible. Unfortunately the
Diagnostic.data[] content is not specified; there is just a custom and
practice, so OCL does what makes the Sample Ecore Model Editor look
good. Clearly EMF Forms needs more, so OCL can be enhanced accordingly.
The only way that EMF Forms can reconstruct the missing information is
to re-execute the OCL validation directly and I'm sure the EMF Forms
team will be delighted to add a dependency on OCL just to fix this.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=465397 raised.
Regards
Ed Willink
On 24/04/2015 10:17, Eugen Neufeld wrote:
> Hi Uwe, thank you for your update. The target definition points to the
> current eclipse instance. I don't have OCL and all the needed
> dependencies in my Eclipse so the target definition doesn't help :).
> But I could reproduce the problem with your new product and the
> description on how to load the OCL file.
> If you want to make sure, that our current assumption is correct, you
> can debug the validation handling in emfforms. For this I would
> recommend to set a breakpoint in
> org.eclipse.emf.ecp.view.internal.validation.ValidationServiceImpl#validateAndCollectSettings
> . You can then simply check what information the resulting diagnostic
> (or its children) contains.
>
> I suspect, that OCL won't work out of the box with EMFForms. In order
> to get it working, you will have to either change the way OCL
> generated Diagnostics or change the way EMFForms parses the
> information about where to add the diagnostic to.
> Cheers,
> Eugen
|
|
| |
Re: EMFForms Validation using Complete OCL [message #1693495 is a reply to message #1693454] |
Fri, 24 April 2015 10:23  |
Eclipse User |
|
|
|
Hi,
I think as the issue seems clear now, we do not need another TP.
Best regards
Jonas
Am 24.04.2015 um 12:42 schrieb Uwe San:
> Hi,
>
> It seems like we have identified the root cause of the initial problem.
> Thank you to everyone who spent time on this!
>
> As Ed said, I think it would more make sense to fix this issue on the
> OCL side rather than on the EMFForms side, in particular because this
> issue affects the regular properties view as well, so it is not specific
> to EMFForms.
>
> Eugen, please let me know if you would like me to provide another TP
> definition (a more helpful one than previously) in case you are going to
> investigate this issue any further.
>
> Cheers,
> Uwe
--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Goto Forum:
Current Time: Wed Jul 23 17:49:57 EDT 2025
Powered by FUDForum. Page generated in 0.28204 seconds
|