Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2007-06-05 13:39:12 +0000
committeratikhomirov2007-06-05 13:39:12 +0000
commit9d7780e3b395dfbc37d597219db274d5a415dad1 (patch)
tree15a6bbaa2d648a7f991aae2707782bc4d6177bae
parent447a8f2a85fd5b3edfb244871149b9bfc786cf72 (diff)
downloadorg.eclipse.gmf-tooling-9d7780e3b395dfbc37d597219db274d5a415dad1.tar.gz
org.eclipse.gmf-tooling-9d7780e3b395dfbc37d597219db274d5a415dad1.tar.xz
org.eclipse.gmf-tooling-9d7780e3b395dfbc37d597219db274d5a415dad1.zip
handle composite custom borders (fixes failing test) in a way that doesn't mandate any special additional output streams
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Border.xpt24
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Util.ext2
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.xpt2
3 files changed, 18 insertions, 10 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Border.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Border.xpt
index 02847b54f..5ed36edc6 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Border.xpt
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Border.xpt
@@ -18,12 +18,16 @@
«figureVarName».setBorder(«EXPAND border(figureVarName)»);
«ENDDEFINE»
-«DEFINE Init(String figureVarName) FOR gmfgraph::CustomBorder-»
-{
- «EXPAND Runtime::newInstance("result")»
- «EXPAND attr::CustomClass::Init("result")»
- «figureVarName».setBorder(result);
-}
+«DEFINE InitMethods FOR gmfgraph::Figure»
+«FOREACH getBordersInUse() AS b»«EXPAND initMethod(getBordersInUse().indexOf(b)) FOR b»«ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE initMethod(int c) FOR gmfgraph::CustomBorder-»
+ private org.eclipse.draw2d.Border createBorder«c»() {
+ «EXPAND Runtime::newInstance("result")»
+ «EXPAND attr::CustomClass::Init("result")»
+ return result;
+ }
«ENDDEFINE»
«DEFINE border(String figureVarName) FOR gmfgraph::Border»
@@ -37,9 +41,9 @@ new org.eclipse.draw2d.LineBorder(«IF null == color»null«ELSE»«EXPAND attr::Figu
new org.eclipse.draw2d.MarginBorder(«EXPAND MapMode::map FOR insets»)«ENDDEFINE»
«DEFINE border(String figureVarName) FOR gmfgraph::CompoundBorder-»
-new org.eclipse.draw2d.CompoundBorder(«IF outer == null»null«ELSE»«EXPAND internalNewInstance(figureVarName) FOR outer»«ENDIF», «IF inner == null»null«ELSE»«EXPAND internalNewInstance(figureVarName) FOR inner»«ENDIF»)
+new org.eclipse.draw2d.CompoundBorder(«IF outer == null»null«ELSE»«EXPAND border(figureVarName) FOR outer»«ENDIF», «IF inner == null»null«ELSE»«EXPAND border(figureVarName) FOR inner»«ENDIF»)
«ENDDEFINE»
-«DEFINE internalNewInstance(String figureVarName) FOR gmfgraph::Border-»
-«IF {this}.typeSelect(gmfgraph::CustomBorder).isEmpty()»«EXPAND border(figureVarName)»«ELSE»«EXPAND Runtime::newInstance»«ENDIF-»
-«ENDDEFINE»
+«DEFINE border(String figureVarName) FOR gmfgraph::CustomBorder-»
+createBorder«getBordersInUse().size()»()«getBordersInUse().add(this)->""-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Util.ext b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Util.ext
index 7c3dc7e49..a0eb7452d 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Util.ext
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Util.ext
@@ -94,6 +94,8 @@ String borderLayoutConstant(gmfgraph::BorderLayoutData layoutData) :
}
;
+cached List[gmfgraph::CustomBorder] getBordersInUse() : {} ;
+
EString messageFormat(EString pattern, List[Object] argument) :
JAVA java.text.MessageFormat.format(java.lang.String, java.lang.Object.List)
; \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.xpt
index 6bf15569f..6606ffe82 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.xpt
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.xpt
@@ -26,12 +26,14 @@
* @generated
*/
public «cuName»() {
+«getBordersInUse().clear()->""-»
«EXPAND Layout::Init("this") FOR layout-»
«EXPAND Attrs::Init("this")-»
«IF !children.typeSelect(Figure).isEmpty()-»
createContents();
}
«EXPAND Children::CreateChildren-»
+«EXPAND Border::InitMethods»
«ELSE-»
}
«ENDIF-»

Back to the top