Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates/customBorderFactoryMethods.jetinc')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/customBorderFactoryMethods.jetinc38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/customBorderFactoryMethods.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/customBorderFactoryMethods.jetinc
new file mode 100644
index 000000000..78d4422f3
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/customBorderFactoryMethods.jetinc
@@ -0,0 +1,38 @@
+<%
+//input: [oeg].common.codegen.ImportAssistant importManager
+//input: [oeg].graphdef.codegen GraphDefDispatcher dispatcher
+//input: [oeg].gmfgraph.Figure figure
+
+{ //namespace -- use "bfm" (stands for BorderFactoryMethod) to avoid name clashes
+ int bfmNextIndex = 1;
+ String bfmLastFigureName = "";
+ for (Iterator bfmAllCustomBorders = EcoreUtil.getAllContents(figure, false); bfmAllCustomBorders.hasNext();){
+ EObject bfmNext = (EObject)bfmAllCustomBorders.next();
+ if (GMFGraphPackage.eINSTANCE.getFigure().isSuperTypeOf(bfmNext.eClass())){
+ bfmLastFigureName = (String)bfmNext.eGet(GMFGraphPackage.eINSTANCE.getIdentity_Name());
+ if (bfmLastFigureName == null){
+ bfmLastFigureName = "";
+ }
+ }
+ // XXX [artem] why not do this with ((Figure) bfmNext).getBorder()?
+ if (bfmNext.eClass().getClassifierID() != GMFGraphPackage.CUSTOM_BORDER){
+ continue;
+ }
+
+ String bfmNextImplClass = dispatcher.getFQNSwitch().get(bfmNext, importManager);
+ String bfmNextMethodName = "createBorder_" + CodeGenUtil.capName(bfmLastFigureName) + "_" + (bfmNextIndex++);
+
+%>
+ /**
+ * @generated
+ */
+ private <%=importManager.getImportedName("org.eclipse.draw2d.Border")%> <%=bfmNextMethodName%>() {
+ <%=bfmNextImplClass%> result = new <%=bfmNextImplClass%>();
+ <%=dispatcher.dispatch("customAttributes", new Object[] {bfmNext, dispatcher, "result"} )%>
+ return result;
+ }
+<%
+ dispatcher.getAuxiliaryDataStorage().registerData(bfmNext, bfmNextMethodName);
+ }
+} //end of namespace
+%>

Back to the top