Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-05-25 14:06:30 +0000
committeratikhomirov2006-05-25 14:06:30 +0000
commit166823d15faf73b5ba42a687e9276824142224d0 (patch)
tree37d1715c6954e95bf2f723771a4a88a3d6033b8e /plugins/org.eclipse.gmf.graphdef.codegen
parent22dbf7d2719e585fd859932a7142e6df21d85a51 (diff)
downloadorg.eclipse.gmf-tooling-166823d15faf73b5ba42a687e9276824142224d0.tar.gz
org.eclipse.gmf-tooling-166823d15faf73b5ba42a687e9276824142224d0.tar.xz
org.eclipse.gmf-tooling-166823d15faf73b5ba42a687e9276824142224d0.zip
[mgolubev] #139148 Respect gmfgraph.compartment figure
[mgolubev] #143619 Temp fix for misassumption of ParentAssignedViewmap regarding generated getter name
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java24
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java5
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet3
3 files changed, 29 insertions, 3 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java
new file mode 100644
index 000000000..95d86b3ac
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * 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:
+ * Michael Golubev (Borland) - initial API and implementation
+ */
+
+package org.eclipse.gmf.graphdef.codegen;
+
+import org.eclipse.emf.codegen.util.CodeGenUtil;
+import org.eclipse.gmf.gmfgraph.Figure;
+
+public class NamingStrategy {
+ public static NamingStrategy INSTANCE = new NamingStrategy();
+
+ public String getChildFigureGetterName(Figure childFigure){
+ return "getFigure" + CodeGenUtil.capName(CodeGenUtil.validJavaIdentifier(childFigure.getName()));
+ }
+}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java
index 04b5ae89e..0fe2ea227 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java
@@ -33,7 +33,7 @@ public class FigureChildrenGenerator
protected final String TEXT_12 = NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
protected final String TEXT_13 = " f";
protected final String TEXT_14 = "; " + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_15 = " getFigure";
+ protected final String TEXT_15 = " ";
protected final String TEXT_16 = "() {" + NL + "\t\treturn f";
protected final String TEXT_17 = ";" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setFigure";
protected final String TEXT_18 = "(";
@@ -54,6 +54,7 @@ final List/*<Figure>*/ fieldsRequired = new LinkedList/*<Figure>*/();
final Stack/*GraphDefDispatcher.LayoutArgs*/ contextStack = new Stack/*GraphDefDispatcher.LayoutArgs*/();
final LinkedList queue = new LinkedList();
final Object marker = new Object();
+final NamingStrategy namingStrategy = NamingStrategy.INSTANCE;
class FieldSupport {
private final Figure myRoot;
@@ -132,7 +133,7 @@ if (fieldSupport.isFieldRequired(nextChild)){
stringBuffer.append(TEXT_14);
stringBuffer.append(nextClassName);
stringBuffer.append(TEXT_15);
- stringBuffer.append(next.getName());
+ stringBuffer.append(namingStrategy.getChildFigureGetterName(next));
stringBuffer.append(TEXT_16);
stringBuffer.append(CodeGenUtil.capName(next.getName()));
stringBuffer.append(TEXT_17);
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet
index 3a1192f49..b687ec355 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet
@@ -10,6 +10,7 @@ final List/*<Figure>*/ fieldsRequired = new LinkedList/*<Figure>*/();
final Stack/*GraphDefDispatcher.LayoutArgs*/ contextStack = new Stack/*GraphDefDispatcher.LayoutArgs*/();
final LinkedList queue = new LinkedList();
final Object marker = new Object();
+final NamingStrategy namingStrategy = NamingStrategy.INSTANCE;
class FieldSupport {
private final Figure myRoot;
@@ -83,7 +84,7 @@ if (fieldSupport.isFieldRequired(nextChild)){
/**
* @generated
*/
- public <%=nextClassName%> getFigure<%=next.getName()%>() {
+ public <%=nextClassName%> <%=namingStrategy.getChildFigureGetterName(next)%>() {
return f<%=CodeGenUtil.capName(next.getName())%>;
}

Back to the top