Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigPostprocessor.ext')
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigPostprocessor.ext66
1 files changed, 66 insertions, 0 deletions
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigPostprocessor.ext b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigPostprocessor.ext
new file mode 100644
index 000000000..4d671e547
--- /dev/null
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigPostprocessor.ext
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Juergen Haug
+ *
+ *******************************************************************************/
+
+import ecore;
+import xtext;
+
+process(xtext::GeneratedMetamodel this) :
+ process(ePackage)
+;
+
+process(ecore::EPackage this) :
+ this.eClassifiers.typeSelect(ecore::EClass).process()
+;
+
+process(EClass this) :
+ switch(name){
+ case("ConfigModel"):
+ (addOperation(
+ "getActorClassConfigs",
+ ePackage.getEClassifier("ActorClassConfig"),
+ -1,
+ 'EList<ActorClassConfig> list = new org.eclipse.emf.common.util.BasicEList<ActorClassConfig>();
+ for(ConfigElement element : this.getConfigElements())
+ if(element instanceof ActorClassConfig)
+ list.add((ActorClassConfig) element);
+ return list;'
+ )->addOperation(
+ "getActorInstanceConfigs",
+ ePackage.getEClassifier("ActorInstanceConfig"),
+ -1,
+ 'EList<ActorInstanceConfig> list = new org.eclipse.emf.common.util.BasicEList<ActorInstanceConfig>();
+ for(ConfigElement element : this.getConfigElements())
+ if(element instanceof ActorInstanceConfig)
+ list.add((ActorInstanceConfig) element);
+ return list;'
+ ))
+ default: null
+ }
+;
+
+create ecore::EOperation addOperation(ecore::EClassifier c, String strName, ecore::EClassifier type, Integer upperBound, String strBody):
+ setName(strName) ->
+ setEType(type) ->
+ setUpperBound(upperBound)->
+ addBodyAnnotation(strBody)->
+ ((ecore::EClass)c).eOperations.add(this);
+
+
+create ecore::EAnnotation addBodyAnnotation(ecore::EOperation op, String strBody):
+ setSource("http://www.eclipse.org/emf/2002/GenModel") ->
+ this.createBody(strBody) ->
+ op.eAnnotations.add(this);
+
+create ecore::EStringToStringMapEntry createBody(ecore::EAnnotation anno, String strBody):
+ setKey("body") ->
+ setValue(strBody) ->
+ anno.details.add(this);

Back to the top