Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2010-04-21 20:30:34 +0000
committeratikhomirov2010-04-21 20:30:34 +0000
commit0885e8eef90a367f467871a80ed43f856131528e (patch)
tree8f46ceff0aa0a7f2a68dc3c566dab0926f75c5d8 /plugins/org.eclipse.gmf.graphdef.codegen
parent26d64960af22b5904ccfce18105aa4427f8b0e7f (diff)
downloadorg.eclipse.gmf-tooling-0885e8eef90a367f467871a80ed43f856131528e.tar.gz
org.eclipse.gmf-tooling-0885e8eef90a367f467871a80ed43f856131528e.tar.xz
org.eclipse.gmf-tooling-0885e8eef90a367f467871a80ed43f856131528e.zip
[251372] use Draw2d.ScalablePolygonShape instead custom code
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Children.xpt12
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Extras.xpt10
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Runtime.xpt6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/xtras/ScalablePolygon.xpt81
4 files changed, 10 insertions, 99 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Children.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Children.xpt
index 593de4454..c2abf8345 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Children.xpt
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Children.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corporation
+ * Copyright (c) 2006, 2010 Borland Software Corporation and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,7 +11,7 @@
*/
«IMPORT 'http://www.eclipse.org/gmf/2006/GraphicalDefinition'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
«EXTENSION Util»
«DEFINE CreateChildren FOR gmfgraph::RealFigure-»
@@ -48,11 +48,3 @@
«DEFINE newFigureInstance(figureVarName : String) FOR gmfgraph::RealFigure»«IF needsField(self)»«figureVarName» = «EXPAND Runtime::newInstance»;«ELSE»«EXPAND Runtime::newInstance(figureVarName)»«ENDIF»«ENDDEFINE»
-«DEFINE newFigureInstance(figureVarName : String) FOR gmfgraph::ScalablePolygon-»
-«LET figureVarName.firstToUpper() + 'Class' AS localClassName-»
-class «localClassName» extends «EXPAND Runtime::fqn» {
-«EXPAND xtras::ScalablePolygon::behaviour-»
-};
-«IF not needsField(self)»«localClassName» «ENDIF»«figureVarName» = new «localClassName»();
-«ENDLET-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Extras.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Extras.xpt
index f41bf965f..45b38fbc5 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Extras.xpt
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Extras.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006 Borland Software Corporation
+ * Copyright (c) 2006, 2010 Borland Software Corporation and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,14 +11,14 @@
*/
«IMPORT 'http://www.eclipse.org/gmf/2006/GraphicalDefinition'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
«EXTENSION Util»
«DEFINE localCoordinates FOR gmfgraph::RealFigure»
/**
* @generated
*/
- private boolean myUseLocalCoordinates = «not (children)[gmfgraph::Polyline]->isEmpty()»;
+ private boolean myUseLocalCoordinates = «children[gmfgraph::Polyline]->notEmpty()»;
/**
* @generated
@@ -45,10 +45,6 @@
«DEFINE extraMethods FOR gmfgraph::Figure-»
«ENDDEFINE»
-«DEFINE extraMethods FOR gmfgraph::ScalablePolygon-»
-«EXPAND xtras::ScalablePolygon::behaviour-»
-«ENDDEFINE»
-
«DEFINE extraMethods FOR gmfgraph::SVGFigure-»
«EXPAND svgProperty FOREACH properties-»
«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Runtime.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Runtime.xpt
index dc0547547..8615e6fd6 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Runtime.xpt
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Runtime.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007 Borland Software Corporation
+ * Copyright (c) 2007, 2010 Borland Software Corporation and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,7 +11,7 @@
*/
«IMPORT 'http://www.eclipse.org/gmf/2006/GraphicalDefinition'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
«EXTENSION Util»
«DEFINE newInstance(figureVarName : String) FOR gmfgraph::Figure»«EXPAND fqn» «figureVarName» = «EXPAND newInstance»;«ENDDEFINE»
@@ -57,7 +57,7 @@
«DEFINE fqn FOR gmfgraph::RoundedRectangle»org.eclipse.draw2d.RoundedRectangle«ENDDEFINE»
«DEFINE fqn FOR gmfgraph::Ellipse»org.eclipse.draw2d.Ellipse«ENDDEFINE»
«DEFINE fqn FOR gmfgraph::Polygon»org.eclipse.draw2d.Polygon«ENDDEFINE»
-«REM»FIXME«ENDREM»«DEFINE fqn FOR gmfgraph::ScalablePolygon»org.eclipse.draw2d.Shape«ENDDEFINE»
+«DEFINE fqn FOR gmfgraph::ScalablePolygon»org.eclipse.draw2d.ScalablePolygonShape«ENDDEFINE»
«DEFINE fqn FOR gmfgraph::PolygonDecoration»org.eclipse.draw2d.PolygonDecoration«ENDDEFINE»
«DEFINE fqn FOR gmfgraph::Polyline»org.eclipse.draw2d.Polyline«ENDDEFINE»
«DEFINE fqn FOR gmfgraph::PolylineDecoration»org.eclipse.draw2d.PolylineDecoration«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/xtras/ScalablePolygon.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/xtras/ScalablePolygon.xpt
index bcbd7e63c..30db3296d 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/xtras/ScalablePolygon.xpt
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/xtras/ScalablePolygon.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006 Borland Software Corporation
+ * Copyright (c) 2006, 2010 Borland Software Corporation and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,84 +11,7 @@
*/
«IMPORT 'http://www.eclipse.org/gmf/2006/GraphicalDefinition'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-
«DEFINE behaviour FOR gmfgraph::ScalablePolygon-»
- /**
- * @generated
- */
- private final org.eclipse.draw2d.geometry.PointList myTemplate = new org.eclipse.draw2d.geometry.PointList();
- /**
- * @generated
- */
- private org.eclipse.draw2d.geometry.Rectangle myTemplateBounds;
-
- /**
- * @generated
- */
- public void addPoint(org.eclipse.draw2d.geometry.Point point){
- myTemplate.addPoint(point);
- myTemplateBounds = null;
- }
-
- /**
- * @generated
- */
- protected void fillShape(org.eclipse.draw2d.Graphics graphics) {
- org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
- graphics.pushState();
- graphics.translate(bounds.x, bounds.y);
- graphics.fillPolygon(scalePointList());
- graphics.popState();
- }
-
- /**
- * @generated
- */
- protected void outlineShape(org.eclipse.draw2d.Graphics graphics) {
- org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
- graphics.pushState();
- graphics.translate(bounds.x, bounds.y);
- graphics.drawPolygon(scalePointList());
- graphics.popState();
- }
-
- /**
- * @generated
- */
- private org.eclipse.draw2d.geometry.Rectangle getTemplateBounds(){
- if (myTemplateBounds == null){
- myTemplateBounds = myTemplate.getBounds().getCopy().union(0, 0);
- //just safety -- we are going to use this as divider
- if (myTemplateBounds.width < 1){
- myTemplateBounds.width = 1;
- }
- if (myTemplateBounds.height < 1){
- myTemplateBounds.height = 1;
- }
- }
- return myTemplateBounds;
- }
-
- /**
- * @generated
- */
- private int[] scalePointList() {
- org.eclipse.draw2d.geometry.Rectangle pointsBounds = getTemplateBounds();
- org.eclipse.draw2d.geometry.Rectangle actualBounds = getBounds();
-
- float xScale = ((float) actualBounds.width) / pointsBounds.width;
- float yScale = ((float) actualBounds.height) / pointsBounds.height;
-
- if (xScale == 1 && yScale == 1) {
- return myTemplate.toIntArray();
- }
- int[] scaled = (int[]) myTemplate.toIntArray().clone();
- for (int i = 0; i < scaled.length; i += 2) {
- scaled[i] = (int) Math.floor(scaled[i] * xScale);
- scaled[i + 1] = (int) Math.floor(scaled[i + 1] * yScale);
- }
- return scaled;
- }
+ FIXME - with 238874 resolved, generated ScalablePolygon hack has been replaced with use of org.eclipse.draw2d.ScalablePolygonShape
«ENDDEFINE» \ No newline at end of file

Back to the top