|
Re: [EVL] Call Operations of Metamodel [message #1725996 is a reply to message #1725985] |
Tue, 08 March 2016 22:12 |
|
Hi Martin,
If you've added an EOperation to an EClass and implemented its behaviour in the code generated by EMF, you should be able to invoke it directly from EOL/EVL on instances of that EClass. For example, if your EClass is called "X" and your EOperation is called "op", the following code should work.
Cheers,
Dimitris
|
|
|
Re: [EVL] Call Operations of Metamodel [message #1726002 is a reply to message #1725996] |
Tue, 08 March 2016 23:09 |
Glatz Martin Messages: 23 Registered: March 2016 |
Junior Member |
|
|
Hello Dimitris,
thanks a lot for your quick reply.
I've removed the wrapper function in the meantime, but somehow the EOperation is not found.
I have simplified my example in the meantime - my Operation declaration looks as follows (EOperation op in class InstanceHierarchy):
[code]
<eClassifiers xsi:type="ecore:EClass" name="InstanceHierarchy" eSuperTypes="#//CAEXObject">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="InstanceHierarchy"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eOperations name="op" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return "Operation executed";"/>
</eAnnotations>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EReference" name="internalElement" upperBound="-1"
eType="#//InternalElement" containment="true" resolveProxies="false">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Shall be used in order to define nested objects inside of a SystemUnitClass or another InternalElement. Allows description of the internal structure of an CAEX object."/>
</eAnnotations>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="InternalElement"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
Then I generate model Code - basically the test functionality is already there, as I've put it in the model for now.
The EVL file looks as follows (I know doesn't make much sense)
context CAEX!InstanceHierarchy
{
constraint IsIDUnique
{
check: self.op().println()
message : self + ": ID's are not unique"
}
}
But still I get the error message:
Method 'op' not found for: InstanceHierarchy [changeMode=state, iD=null, name=, ]
I'm running the application with a debug-Configuration in Eclipse, where I've introduced the CAEX model and metamodel.
In addition it's not quite clear for me how the generated model code is integrated here - it's generated as a different project - I've copied the model code etc. to the project where the EVL file is located, but that didn't help either.
Do you have any idea, what I'm missing here?
Thanks a lot,
Best regards
Martin
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02738 seconds