[EVL] Call Operations of Metamodel [message #1725985] |
Tue, 08 March 2016 15:39  |
Eclipse User |
|
|
|
Hello,
I'm quite new to EVL and I'd appreciate your help with the following problem.
I have an ECore metamoodel where I have a hiearchy of classes. I'd like to implement some kind of API in the metamodel (e.g. traverse the tree and get all Elements of a specific typ) - so I've created an operation in the mode, generated the model code and edited the code there.
Now I'd like to access this code.
I've tried the basic "access java code from EOL/EVL" - the examples with setText, getText etc. work fine, but I would like to hand over e.g. the "root element of the concrete model", to traverse it with my API functionality.
I've created a static helper Method in my "Tool-java-class", but when I call it like
var t : new Native("amlutil.ModelTransformer");
t.getAllIEs(self);
the method is not found.
Is there a way to achive the functionality I want to implement or do you have any suggestions?
Thanks a lot in advance,
Martin
|
|
|
|
Re: [EVL] Call Operations of Metamodel [message #1726002 is a reply to message #1725996] |
Tue, 08 March 2016 18:09   |
Eclipse User |
|
|
|
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.06676 seconds