Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormgolubev2012-05-23 02:12:18 -0400
committermgolubev2012-05-23 02:12:18 -0400
commita835d75e5e5642020c4528f203442a1112856ee0 (patch)
treeca2c6d8ee189b611219e22c3ecb2d4ddcfc36d9d /plugins/org.eclipse.gmf.codegen/models
parent16559682fd39352125bf70231b97c67682d4abf9 (diff)
downloadorg.eclipse.gmf-tooling-a835d75e5e5642020c4528f203442a1112856ee0.tar.gz
org.eclipse.gmf-tooling-a835d75e5e5642020c4528f203442a1112856ee0.tar.xz
org.eclipse.gmf-tooling-a835d75e5e5642020c4528f203442a1112856ee0.zip
[380352] - generator extensions to produce code which can't be generated
with AROUND's
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/models')
-rw-r--r--plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore79
-rw-r--r--plugins/org.eclipse.gmf.codegen/models/gmfgen.emf47
-rw-r--r--plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel30
3 files changed, 148 insertions, 8 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore b/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
index fc98d5577..4a7426d07 100644
--- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
+++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="gmfgen"
- nsURI="http://www.eclipse.org/gmf/2009/GenModel" nsPrefix="gmfgen">
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="gmfgen" nsURI="http://www.eclipse.org/gmf/2009/GenModel" nsPrefix="gmfgen">
<eAnnotations source="http://www.eclipse.org/emf/2004/EmfaticAnnotationMap">
<details key="constraints" value="http://www.eclipse.org/gmf/2005/constraints"/>
<details key="meta" value="http://www.eclipse.org/gmf/2005/constraints/meta"/>
@@ -97,6 +95,12 @@
<details key="documentation" value="The target directory for generated editor code. Similar to EMF's GenModel#editorDirectory"/>
</eAnnotations>
</eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="extensions" upperBound="-1"
+ eType="#//GenCustomGeneratorExtension" containment="true" eOpposite="#//GenCustomGeneratorExtension/generator">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Custom extensions for this generator"/>
+ </eAnnotations>
+ </eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GenDiagram" eSuperTypes="#//GenContainerBase #//PackageNames #//ProviderClassNames #//LinkConstraints #//EditPartCandies #//EditorCandies #//Shortcuts #//BatchValidation #//MeasurementUnit">
<eAnnotations source="http://www.eclipse.org/gmf/2005/constraints">
@@ -2367,4 +2371,71 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="operationType" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="oclExpression" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="GenCustomGeneratorExtension" eSuperTypes="#//GenCustomTemplateInput">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="generator" lowerBound="1"
+ eType="#//GenEditorGenerator" changeable="false" volatile="true" transient="true"
+ derived="true" eOpposite="#//GenEditorGenerator/extensions"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="User friendly name for this extension, used only in UI"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="fromCustomBridge" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+ defaultValueLiteral="false">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Reconciler should try to preserve the contents if set to true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="rootInput" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Root input element for custom template invocations. GenEditorGenerator single instance will be assumed if not set"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="invocations" upperBound="-1"
+ eType="#//GenTemplateInvocationBase" containment="true" eOpposite="#//GenTemplateInvocationBase/extension"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="GenCustomTemplateInput" abstract="true"
+ interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="oclType" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="OCL Type for this input, if not set generator will try to compute it"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="GenTemplateInvocationBase" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="extension" lowerBound="1"
+ eType="#//GenCustomGeneratorExtension" changeable="false" volatile="true"
+ transient="true" derived="true" eOpposite="#//GenCustomGeneratorExtension/invocations"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="User friendly description for this invocation, used only in UI"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="templateFqn" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="FQN of xPand template to invoke in the standard form of abc::def::TemplateName#rootExpand"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="GenTemplateInvocation" eSuperTypes="#//GenTemplateInvocationBase">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="inputs" upperBound="-1"
+ eType="#//GenCustomTemplateInput">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Set of referenced inputs for this invocation, "/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="oclExpression" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="OCL expression to be executed against the set of other inputs to compute the inputs for template"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="GenFixedInputsTemplateInvocation" eSuperTypes="#//GenTemplateInvocationBase #//GenCustomTemplateInput">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="fixedInputs" upperBound="-1"
+ eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Predefined set of input elements for template. &#xA;&#x9;&#x9;Due to reconciling it normally makes sense only for local links inside the same extension or &#xA;&#x9;&#x9;for extensions created by custom bridge extension (self.extension.fromCustomBridge = true)"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
</ecore:EPackage>
diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.emf b/plugins/org.eclipse.gmf.codegen/models/gmfgen.emf
index dcdcd6195..9b3353180 100644
--- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.emf
+++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.emf
@@ -60,6 +60,10 @@ class GenEditorGenerator {
val GenContextMenu[*] contextMenus; // XXX perhaps, as GenPlugin attribute instead?
@genmodel(documentation="The target directory for generated editor code. Similar to EMF's GenModel#editorDirectory")
attr String pluginDirectory;
+
+ @genmodel(documentation="Custom extensions for this generator")
+ val GenCustomGeneratorExtension[*]#generator extensions;
+
}
@constraints(ocl="diagramRunTimeClass.ecoreClass.eAllSuperTypes->including(diagramRunTimeClass.ecoreClass)->one(ePackage.name = 'notation' and name = 'Diagram')", description="'Diagram Runtime Class' must be a notation::Diagram or sub-class")
@@ -1646,3 +1650,46 @@ class GenVisualEffect extends CustomBehaviour {
op String getOclExpressionString();
op ecore.EClassifier getOperationRuntimeType();
}
+
+class GenCustomGeneratorExtension extends GenCustomTemplateInput {
+ readonly volatile transient derived ref GenEditorGenerator[1]#extensions generator;
+
+ @genmodel(documentation="User friendly name for this extension, used only in UI")
+ attr String name;
+ @genmodel(documentation="Reconciler should try to preserve the contents if set to true")
+ attr boolean fromCustomBridge = false;
+
+ @genmodel(documentation="Root input element for custom template invocations. GenEditorGenerator single instance will be assumed if not set")
+ ref ecore.EObject[?] rootInput;
+
+ val GenTemplateInvocationBase[*]#extension invocations;
+}
+
+abstract interface GenCustomTemplateInput {
+ @genmodel(documentation="OCL Type for this input, if not set generator will try to compute it")
+ attr String oclType;
+}
+
+abstract class GenTemplateInvocationBase {
+ readonly volatile transient derived ref GenCustomGeneratorExtension[1]#invocations extension;
+
+ @genmodel(documentation="User friendly description for this invocation, used only in UI")
+ attr String description;
+ @genmodel(documentation="FQN of xPand template to invoke in the standard form of abc::def::TemplateName#rootExpand")
+ attr String templateFqn;
+}
+
+class GenTemplateInvocation extends GenTemplateInvocationBase {
+ @genmodel(documentation="Set of referenced inputs for this invocation, ")
+ ref GenCustomTemplateInput[*] inputs;
+ @genmodel(documentation="OCL expression to be executed against the set of other inputs to compute the inputs for template")
+ attr String oclExpression;
+}
+
+class GenFixedInputsTemplateInvocation extends GenTemplateInvocationBase, GenCustomTemplateInput {
+ @genmodel(documentation="Predefined set of input elements for template.
+ Due to reconciling it normally makes sense only for local links inside the same extension or
+ for extensions created by custom bridge extension (self.extension.fromCustomBridge = true)")
+ ref ecore.EObject[*] fixedInputs;
+}
+
diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel b/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
index 36e62f646..92148e663 100644
--- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
+++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<genmodel:GenModel xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.gmf.codegen/src"
- creationIcons="false" editorDirectory="/org.eclipse.gmf.codegen.edit/src" modelPluginID="org.eclipse.gmf.codegen"
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.gmf.codegen/src" creationIcons="false"
+ editorDirectory="/org.eclipse.gmf.codegen.edit/src" modelPluginID="org.eclipse.gmf.codegen"
modelName="GMFGen" editPluginClass="org.eclipse.gmf.codegen.gmfgen.presentation.EditorPlugin"
editorPluginClass="org.eclipse.gmf.codegen.gmfgen.presentation.EditorPlugin" rootImplementsInterface=""
featureMapWrapperInterface="" booleanFlagsField="" importerID="org.eclipse.emf.importer.ecore"
@@ -172,6 +171,7 @@
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgen.ecore#//GenEditorGenerator/contextMenus"/>
<genFeatures createChild="false" propertyDescription="The target directory for generated editor code"
ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenEditorGenerator/pluginDirectory"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgen.ecore#//GenEditorGenerator/extensions"/>
<genOperations ecoreOperation="gmfgen.ecore#//GenEditorGenerator/getAllDomainGenPackages">
<genParameters ecoreParameter="gmfgen.ecore#//GenEditorGenerator/getAllDomainGenPackages/withUsed"/>
</genOperations>
@@ -1065,5 +1065,27 @@
<genOperations ecoreOperation="gmfgen.ecore#//GenVisualEffect/getOclExpressionString"/>
<genOperations ecoreOperation="gmfgen.ecore#//GenVisualEffect/getOperationRuntimeType"/>
</genClasses>
+ <genClasses ecoreClass="gmfgen.ecore#//GenCustomGeneratorExtension">
+ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference gmfgen.ecore#//GenCustomGeneratorExtension/generator"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenCustomGeneratorExtension/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenCustomGeneratorExtension/fromCustomBridge"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference gmfgen.ecore#//GenCustomGeneratorExtension/rootInput"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgen.ecore#//GenCustomGeneratorExtension/invocations"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="gmfgen.ecore#//GenCustomTemplateInput">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenCustomTemplateInput/oclType"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="gmfgen.ecore#//GenTemplateInvocationBase">
+ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference gmfgen.ecore#//GenTemplateInvocationBase/extension"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenTemplateInvocationBase/description"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenTemplateInvocationBase/templateFqn"/>
+ </genClasses>
+ <genClasses ecoreClass="gmfgen.ecore#//GenTemplateInvocation">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference gmfgen.ecore#//GenTemplateInvocation/inputs"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenTemplateInvocation/oclExpression"/>
+ </genClasses>
+ <genClasses ecoreClass="gmfgen.ecore#//GenFixedInputsTemplateInvocation">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference gmfgen.ecore#//GenFixedInputsTemplateInvocation/fixedInputs"/>
+ </genClasses>
</genPackages>
</genmodel:GenModel>

Back to the top