Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Native validation with custom OCL files(Using plugin manifest to register custom CompleteOCL files for native validation)
Native validation with custom OCL files [message #1730913] Fri, 29 April 2016 18:03 Go to next message
Roman Tre is currently offline Roman TreFriend
Messages: 5
Registered: April 2016
Junior Member
Hi everybody,

I'll shortly describe what I try to achieve:
When I right-click on a Papyrus UML file (or an Ecore file or any other EMF based model) opened in the Sample Ecore Model Editor, I'm given an option to validate it. Without loading any additional ocl files, it seems, that some default constraints are evaluated by doing that.
I'm curious, if (and how) it's possible to create an extension in the plugin manifest to provide a custom CompleteOCL file that is registered in the runtime instance to use it in this described "native" validation (Note, I'm not talking about the Load Complete OCL File Dialog, I want the file to be directly registered as an additional validation constraint provider).

I had a look at the
org.eclipse.ocl.examples.project.completeocltutorial
tutorial project, where ocl files are registered using the
org.eclipse.ocl.pivot.complete_ocl_registry
extension.
But doing that, these files will be put in a registry and I still have to manually load them via Load Complete OCL Document -> Browse Registered OCL Files. Is it possible to register them directly to the given model?

Background is: I want to create external CompleteOCL files and register them directly to their corresponding models in the plugin settings at development time. Doing so, I hope to be able to programatically/manually use the native "validate" at runtime to let eclipse handle the validation. Or is there a better/cleaner way to achieve this?

Thanks in advance,

Roman
Re: Native validation with custom OCL files [message #1730924 is a reply to message #1730913] Fri, 29 April 2016 20:20 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5518
Registered: July 2009
Senior Member
Hi

What you can do is limited by the narrow focus of the Eclipse UML2
project; precisely what is in the UML specification, rather than what is
implied. Thus my original support for OCL in UML validation contributed
a body-language extension point so that constraint bodies could be
handled in arbitrary languages. However the contribution was rejected,
mandating the extra OCL->Validate extended Validation in the UML editor.

The major problem with Complete OCL is that someone has to activate it.
Ecore provides no EPackageDelegate so auto-loading in Ecore is not
possible.

Papyrus is more enthusiastic about prividing a rich user-focussed
environment so there may be options.

For your case there might be a solution by structuring a UML Import as
an OCL document reference. Papyrus can ignore it, so long as it is
suitably ignoreable. Then the UML2AS conversion for use by OCL can
exploit it. If you want to be really sure that Papyrus ignores it you
could use a stylized Comment.

I am not a big fan of plugin settings, since only a small proportion of
tools will recognize them.

Regards

Ed Willink



On 29/04/2016 19:03, Roman Tre wrote:
> Hi everybody,
>
> I'll shortly describe what I try to achieve:
> When I right-click on a Papyrus UML file (or an Ecore file or any
> other EMF based model) opened in the Sample Ecore Model Editor, I'm
> given an option to validate it. Without loading any additional ocl
> files, it seems, that some default constraints are evaluated by doing
> that.
> I'm curious, if (and how) it's possible to create an extension in the
> plugin manifest to provide a custom CompleteOCL file that is
> registered in the runtime instance to use it in this described
> "native" validation (Note, I'm not talking about the Load Complete OCL
> File Dialog, I want the file to be directly registered as an
> additional validation constraint provider).
>
> I had a look at the
> org.eclipse.ocl.examples.project.completeocltutorial tutorial project,
> where ocl files are registered using the
> org.eclipse.ocl.pivot.complete_ocl_registry extension. But doing that,
> these files will be put in a registry and I still have to manually
> load them via Load Complete OCL Document -> Browse Registered OCL
> Files. Is it possible to register them directly to the given model?
>
> Background is: I want to create external CompleteOCL files and
> register them directly to their corresponding models in the plugin
> settings at development time. Doing so, I hope to be able to
> programatically/manually use the native "validate" at runtime to let
> eclipse handle the validation. Or is there a better/cleaner way to
> achieve this?
>
> Thanks in advance,
>
> Roman
Previous Topic:Standalone validation with CompleteOCL evaluates nothing
Next Topic:OCL XText grammar
Goto Forum:
  


Current Time: Tue Dec 12 00:44:09 GMT 2017

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

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