blob: 7054dcdd147847966a3f31144f6b84b856eb917c [file] [log] [blame]
/*
* Copyright (c) 2006, 2007 Borland Software Corporation
*
* 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"»
«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
«EXTENSION Util»
«DEFINE CreateChildren FOR gmfgraph::RealFigure
/**
* @generated
*/
private void createContents(){
«EXPAND instantiate(0, this, "this") FOREACH children»
}
«ENDDEFINE»
«DEFINE instantiate(EInt count, gmfgraph::RealFigure parentFigure, String parentFigureVariable) FOR gmfgraph::Figure»
«ERROR "Abstract instantiate(int, RealFigure, String)"»
«ENDDEFINE»
«DEFINE instantiate(EInt count, gmfgraph::RealFigure parentFigure, EString parentFigureVariable) FOR gmfgraph::FigureRef
/*FIXME referenced figures are just not yet fully-functional; need process attrs and layout here*/
«EXPAND instantiate(count, parentFigure, parentFigureVariable) FOR figure
«ENDDEFINE»
«DEFINE instantiate(EInt count, gmfgraph::RealFigure parentFigure, EString parentFigureVariable) FOR gmfgraph::RealFigure»
«LET figureVariableName(count) AS figureVarName»
«EXPAND newFigureInstance(figureVarName
«EXPAND Attrs::Init(figureVarName)-»
«IF null == layoutData || 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».addfigureVarName»);
«ELSE
«EXPAND LayoutData::Init(parentFigureVariable, figureVarName) FOR layoutData
«ENDIF
«EXPAND Layout::Init(figureVarName) FOR layout
«EXPAND instantiate(count + 1, this, figureVarName) FOREACH children
«ENDLET»
«ENDDEFINE»
«DEFINE newFigureInstance(String figureVarName) FOR gmfgraph::RealFigure»«IF needsField()»«figureVarName» = «EXPAND Runtime::newInstance»;«ELSE»«EXPAND Runtime::newInstance(figureVarName)»«ENDIF»«ENDDEFINE»
«DEFINE newFigureInstance(String figureVarName) FOR gmfgraph::ScalablePolygon
«LET figureVarName.toFirstUpper() + "Class" AS localClassName
class «localClassName» extends «EXPAND Runtime::fqn» {
«EXPAND xtras::ScalablePolygon::behaviour
};
«IF !needsField()»«localClassName» «ENDIF»«figureVarName» = new «localClassName»();
«ENDLET
«ENDDEFINE»