Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-04-13 15:03:34 +0000
committeratikhomirov2006-04-13 15:03:34 +0000
commitae7cd9882f4b69e6043846f8bce79eea75017331 (patch)
tree8bc560a15b1a9a1ab7bb892ec17ba3b3ed762d7f /plugins/org.eclipse.gmf.graphdef.codegen/templates
parent3a78b7cdbb03293b43b86bd9a94e33d69153f7f2 (diff)
downloadorg.eclipse.gmf-tooling-ae7cd9882f4b69e6043846f8bce79eea75017331.tar.gz
org.eclipse.gmf-tooling-ae7cd9882f4b69e6043846f8bce79eea75017331.tar.xz
org.eclipse.gmf-tooling-ae7cd9882f4b69e6043846f8bce79eea75017331.zip
#135015 some heuristic to provide valid default useLocalCoordinates.
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet23
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet20
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/localCoordinates.jetinc29
3 files changed, 35 insertions, 37 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
index 9233982ca..40ce8a681 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
@@ -18,11 +18,6 @@ public class <%=figure.getName()%> extends <%=fqnSwitch.get(figure, importManage
/**
* @generated
*/
- private boolean myUseLocalCoordinates;
-
- /**
- * @generated
- */
public <%=figure.getName()%>() {
<%
GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "genLayoutManager", null);
@@ -31,19 +26,7 @@ GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figur
<%=dispatcher.dispatch(figure, dispatcherArgs)%>
<%=dispatcher.dispatch("Children", new Object[] {figure.getChildren(), dispatcher, dispatcherArgs})%>
}
-
- /**
- * @generated
- */
- protected boolean useLocalCoordinates() {
- return myUseLocalCoordinates;
- }
-
- /**
- * @generated
- */
- protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
- myUseLocalCoordinates = useLocalCoordinates;
- }
-
+<%if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/%>
+<%@ include file="localCoordinates.jetinc"%>
+<%}%>
}<%importManager.emitSortedImports();%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet
index 4213475b4..47a062230 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet
@@ -18,11 +18,6 @@ public class <%=figure.getName()%> extends <%=fqnSwitch.get(figure, importManage
/**
* @generated
*/
- private boolean myUseLocalCoordinates;
-
- /**
- * @generated
- */
public <%=figure.getName()%>() {
<%
GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "myGenLayoutManager", null);
@@ -77,17 +72,8 @@ for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext(); fc++)
}
<%}%>
- /**
- * @generated
- */
- protected boolean useLocalCoordinates() {
- return myUseLocalCoordinates;
- }
- /**
- * @generated
- */
- protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
- myUseLocalCoordinates = useLocalCoordinates;
- }
+<%if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/%>
+<%@ include file="localCoordinates.jetinc"%>
+<%}%>
}<%importManager.emitSortedImports();%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/localCoordinates.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/localCoordinates.jetinc
new file mode 100644
index 000000000..94e33768e
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/localCoordinates.jetinc
@@ -0,0 +1,29 @@
+<%
+// simple heuristic to detect need for local coordinates
+boolean useLocalDefaultValue = false;
+for (java.util.Iterator it = figure.getChildren().iterator(); it.hasNext(); ) {
+ if (it.next() instanceof Polyline) {
+ useLocalDefaultValue = true;
+ break;
+ }
+}
+%>
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = <%=useLocalDefaultValue%>;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+ \ No newline at end of file

Back to the top