| /* |
| * 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 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Artem Tikhomirov (Borland) - initial API and implementation |
| */ |
| |
| «IMPORT 'http://www.eclipse.org/gmf/2006/GraphicalDefinition'» |
| |
| «EXTENSION Util» |
| |
| «DEFINE CreateChildren FOR gmfgraph::RealFigure-» |
| /** |
| * @generated |
| */ |
| private void createContents(){ |
| «EXPAND instantiate(0, self, 'this') FOREACH children» |
| } |
| «ENDDEFINE» |
| |
| «DEFINE instantiate(count : Integer, parentFigure : gmfgraph::RealFigure, parentFigureVariable : String) FOR gmfgraph::Figure» |
| «ERROR 'Abstract instantiate(int, RealFigure, String)'» |
| «ENDDEFINE» |
| |
| «DEFINE instantiate(count : Integer, parentFigure : gmfgraph::RealFigure, parentFigureVariable : String) FOR gmfgraph::FigureRef-» |
| «LET figureVariableName(figure, count) AS figureVarName» |
| «EXPAND instantiate(count, parentFigure, parentFigureVariable) FOR figure-» |
| // Process FigureRef details |
| «EXPAND populate(count, parentFigure, parentFigureVariable, figureVarName) FOR self-» |
| «ENDLET» |
| «ENDDEFINE» |
| |
| «DEFINE instantiate(count : Integer, parentFigure : gmfgraph::RealFigure, parentFigureVariable : String) FOR gmfgraph::RealFigure» |
| «LET figureVariableName(self, count) AS figureVarName» |
| «EXPAND newFigureInstance(figureVarName)» |
| «EXPAND populate(count, parentFigure, parentFigureVariable, figureVarName) FOR self-» |
| «EXPAND instantiate(count + 1, self, figureVarName) FOREACH children-» |
| «ENDLET» |
| «ENDDEFINE» |
| |
| «DEFINE populate(count : Integer, parentFigure : gmfgraph::RealFigure, parentFigureVariable : String, figureVarName : String) FOR gmfgraph::Figure» |
| «EXPAND Attrs::Init(figureVarName)-» |
| «IF null = layoutData or null = parentFigure.layout-»«REM»Check for (parentLayout != null) to avoid generating data that won't be used. Not sure it's essential, but it was that way with old jet templates«ENDREM» |
| «parentFigureVariable».add(«figureVarName»); |
| «ELSE-» |
| «EXPAND LayoutData::Init(parentFigureVariable, figureVarName) FOR layoutData-» |
| «ENDIF-» |
| «EXPAND Layout::Init(figureVarName) FOR layout-» |
| «ENDDEFINE» |
| |
| «DEFINE newFigureInstance(figureVarName : String) FOR gmfgraph::RealFigure»«IF needsField(self)»«figureVarName» = «EXPAND Runtime::newInstance»;«ELSE»«EXPAND Runtime::newInstance(figureVarName)»«ENDIF»«ENDDEFINE» |
| |