diff options
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-» |