|
|
|
Re: Extending the OCL Standard Library (and using that in the CompleteOCL editor) [message #1391220 is a reply to message #1391133] |
Mon, 30 June 2014 15:55 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
You give me nothing to download and play with, but guessing
No 'OclAny' type in the OCL Standard Library
beans you have a standard library without an OclAny type, which would be
consistent with your library displacing rather than augmenting the basic
standard library.
I think that changing
library lib : lib = 'http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib'
to
library lib
should make it clear that you are extending.
or
library lib : lib = 'http://myLibrary'
will make it clear that you are defining a new library.
Regards
Ed Willink
On 30/06/2014 14:44, Olivier Melois wrote:
> Hello again. Thank you for the tip, I think I'm on the right path but
> still require some help : my custom operation has to be packaged in a
> plugin so it can to be called by the user of the CompleteOCL editor.
> What I did was implementing a
> org.eclipse.ocl.examples.pivot.library.StandardLibraryContribution in
> order to create an extension for the
> org.eclipse.ocl.examples.pivot.standard_library extension point. My
> #getResource Method looks like this :
> @Override
> public Resource getResource() {
> if(resource == null) {
> URI libraryURI =
> URI.createPlatformPluginURI(MyPlugin.PLUGIN_ID +
> "/resources/myLib.oclstdlib", true);
> MetaModelManager metaModelManager = new MetaModelManager();
> ResourceSet resourceSet = new ResourceSetImpl();
> MetaModelManagerResourceSetAdapter.getAdapter(resourceSet,
> metaModelManager);
> BaseCSResource xtextResource =
> (BaseCSResource)resourceSet.getResource(libraryURI, true);
> CS2PivotResourceAdapter adapter =
> xtextResource.getCS2ASAdapter(metaModelManager);
> resource = adapter.getASResource(xtextResource);
> }
> return resource;
> }
>
>
>
> myLib.oclstdlib looks like that :
>
> import 'http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib';
> library lib : lib = 'http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib'
> {
>
> type OCLElement
> {
> operation testOperation(arg : String) : Set(OclElement)
> => 'myJavaPackage.OclInvReferencesOperation';
> }
> }
>
>
>
> (the goal is of course to provide the user with an operation allowing
> the inverse navigation through references pointing to the context
> element. I thought about adding it to the OCLElement type as it would
> go with the oclContents operation. However, when I reference this
> library at runtime in my ocl source file (using the CompleteOCL
> editor), I get the following error message :
> - No 'OclInvalid' type in the OCL Standard Library
> - Unresolved library 'http://myLibrary'
> : No 'OclAny' type in the OCL Standard Library
> Could you give me some pointers on what I should do ?
>
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03261 seconds