This section explain how write template Freemarker which use context comming from :
XML component model force user to select file/folder. Model is typed :
Definition of this type of model which force to select XML file load into Freemarker DOM this file. This DOM can be used into the template. You can find more information into Freemarker documentation to use XML model.
Here a sample with xml type Model used into the template with the key doc :
<#assign classElement = doc["hibernate-mapping"].class /> <#list classElement.property as item> private ${item.@type} ${item.@name}; </#list>
Definition of this type of model which force to select properties file to get instance class of net.sourceforge.akrogen.core.internal.code.properties.ExtendedProperties with properties loaded.
This class extends java.util.LinkedHashMap class which extends java.util.Map.
You can find more information into Freemarker documentation to use model type of java.util.Map.
Here a sample with properties type Model used into the template with the key prop :
<#assign properties = prop.properties /> <#list properties?keys as key> key : ${key} value : ${properties[key]} </#list>
Definition of this type of model which force to select JAVA class to get instance type org.eclipse.jdt.core.IType interface where you can get method org.eclipse.jdt.core.IMethod, and fields org.eclipse.jdt.core.IField of the selected JAVA class.
Here sample of Freemarker template which use this model type of JAVA class putted with pojo key :
<#list pojo.fields as f> <property name="${f.elementName}" type="${f.typeSignature?substring(1)}" column="${f.elementName}" /> </#list>
Definition of this type of model which force to select folder to get instance of java.io.File class of selected folder.
Here sample of Freemarker template with syntaxe square bracket which use this model type of folder putted with dir key :
... [#list dir.listFiles() as f] <treeitem checked="true" > <treerow> [#assign isDirectory = f.isDirectory() /] [#if isDirectory] <treecell label="DIRECTORY : ${f.name}" /> [#else] <treecell label="FILE : ${f.name}" /> [/#if] </treerow> </treeitem> [/#list] ...
Type of the value of this XUL control into template is java.lang.String.
Here sample of Freemarker template which use the value of XUL control :
textbox parameter: ${textboxParam}
where textboxParam is XUL control value with id textboxParam.
But if this control is linked to button type, value used into template is instance JAVA object which depends on type button :
In this case, control value used into th etemplate is type of org.eclipse.jdt.core.IType. To have button which open dialog to search JAVA class, but that control value used into template be java.lang.String o other words to have name of the JAVA class selected you must use classText type for th ebuttton anf notclass type.
Type of the value of this XUL control into template is java.lang.Boolean. If control is selected, value control is true and false otherwise.
Here sample of Freemarker template which use the value of XUL control :
checkbox parameter is <#if checkboxParam >checked<#else>not checked</#if>
where checkboxParam is XUL control value with id checkboxParam.
Type of the value of this XUL control into template is java.lang.Boolean. If control is selected, value control is true and false otherwise.
Here sample of Freemarker template which use the value of XUL control :
radio 1 is <#if radio1Param >selected<#else>not selected</#if> radio 2 is <#if radio2Param >selected<#else>not selected</#if> radio 3 is <#if radio3Param >selected<#else>not selected</#if>
where radio1Param is XUL control value with id radio1Param.
Type of the value of this XUL control into template is java.lang.Boolean. If control is selected, value control is true and false otherwise.
Here sample of Freemarker template which use the value of XUL control :
radio 1 is <#if radio1Param >selected<#else>not selected</#if> radio 2 is <#if radio2Param >selected<#else>not selected</#if> radio 3 is <#if radio3Param >selected<#else>not selected</#if>
where radio1Param is XUL control value with id radio1Param.
Type of the value of this XUL control into template is java.lang.String.
Here sample of Freemarker template which use the value of XUL control :
Value of first combo: ${firstCombo}
where firstCombo is XUL control value with id firstCombo.
TODO
Type of the value of this XUL control into template is org.eclipse.swt.widgets.Table.
Here sample of Freemarker template which use the value of XUL control :
<#assign itemCount = fields.getItemCount() /> <#-- Fields declaration --> <#if itemCount != 0 > <#list 0..itemCount -1 as i> <#assign tableItem = fields.getItem(i) /> <#assign fieldName = tableItem.getText(0) /> <#assign fieldType = tableItem.getText(1) /> private ${fieldType} ${fieldName}; </#list> </#if>
where fields type of org.eclipse.swt.widgets.Table is XUL control value with id fields.