Custom OCL operations in Java
It is also possible to integrate custom OCL operations on UML/ECORE and arbitrary meta models which
are implemented in Java. The custom operations are realized as Eclipse extension points and have to be
customized through the following extensions (defined in info.squam.ocl.editor.community.core):
- info.squam.ocl.editor.custom.uml for UML meta model
- info.squam.ocl.editor.custom.ecore for ECORE and arbitrary meta models
Each of the extensions above need to specify a custom Java class (in the custom plugin.xml) implementing specific interfaces in order to be recognized as an extension:
- info.squam.ocl.editor.community.core.extensions.customocl.ICustomUMLOperation for UML meta model
- info.squam.ocl.editor.community.core.extensions.customocl.ICustomECOREOperation for ECORE and arbitrary meta models
Custom OCL operations must follow a naming convention:
- operation names have to have at least 2 characters
- operation names have to start with the 'x' character
- the second character has to be upper case and not equal to 'X'
Creating a custom OCL operation on UML
- create a new Eclipse Plug-in Project (e.g. called custom.ocl.test)
- add dependencies to info.squam.ocl.editor.community.core AND org.eclipse.ocl.uml to your MANIFEST.MF

- create a Java class inside the new Plug-in Project (e.g. called UMLOperation_1) implementing
the interface info.squam.ocl.editor.community.core.extensions.customocl.ICustomUMLOperation
- implement all interface methods according to the JavaDoc explanation like UMLOperation_1.java
- add the info.squam.ocl.editor.custom.uml extension in the MANIFEST.MF accordingly:

- The custom OCL operation is integrated in the code completion processor and is highlighted in tomato-red
