| import ecore; |
| //import uml ; |
| |
| process(xtext::GeneratedMetamodel this) : |
| process(ePackage) |
| ; |
| |
| process(EPackage this) : |
| eClassifiers.typeSelect(EClass).process() |
| ; |
| |
| /*process(EClass this) : |
| switch (name) { |
| case "Foo": (addOperation("doFoo", getEcoreDataType("EString")) -> addOperation("getBar", ePackage.getEClassifier("Bar"))) |
| default: null |
| } |
| ;*/ |
| |
| process(EClass theClass) : |
| //switch (theClass.name) { |
| // case "ExpressionValueRule": |
| addOperation(theClass, getTypeEClass(), "getExpectedType", |
| "return org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.validation.ContextUtil.getExpectedType(this) ;") -> |
| addOperation(theClass, getElementEClass(), "getContextElement", |
| "return org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.validation.ContextUtil.getContextElement(this) ;") |
| // default: null |
| //} |
| ; |
| |
| EClass getTypeEClass () : |
| JAVA org.eclipse.papyrus.marte.vsl.extensions.XtendUtil.getTypeEClass() ; |
| |
| EClass getElementEClass () : |
| JAVA org.eclipse.papyrus.marte.vsl.extensions.XtendUtil.getElementEClass() ; |
| |
| addOperation(EClass this, EClassifier type, String operationName, String body) : |
| let op = newOperation(this, operationName, type) : |
| newDelegatingBodyAnnotation(op, body) |
| ; |
| |
| create EOperation newOperation(EClass owner, String name, EClassifier type) : |
| setName(name) -> setEType(type) -> owner.eOperations.add(this) |
| ; |
| |
| create EAnnotation newDelegatingBodyAnnotation(EOperation op, String body) : |
| let d = new EStringToStringMapEntry : |
| setSource("http://www.eclipse.org/emf/2002/GenModel") -> |
| d.setKey("body") -> |
| //d.setValue((op.eType != null ? "return " : "") + op.delegateMethodName() + "(this);") -> |
| //d.setValue((op.eType != null ? "return " : "") + op.delegateMethodName() ) -> |
| d.setValue(body) -> |
| details.add(d) -> |
| op.eAnnotations.add(this) |
| ; |
| |
| //delegateMethodName(EOperation this) : |
| //"com.mycompany." + eContainingClass.name + "Helper." + name |
| // " |
| // return org.eclipse.papyrus.marte.vsl.validation.VSLContextUtil.getExpectedType(this) ; |
| // " |
| //; |