gridData.heightHint = 175;
templateGroup.setLayoutData(gridData);
templateGroup.setFont(parent.getFont());
// List for template names
final List templateList = new List(templateGroup, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
GridData templateGridData = new GridData(GridData.FILL_BOTH);
templateList.setLayoutData(templateGridData);
// Text Area for template description
final Text descriptionArea = new Text(templateGroup, SWT.MULTI | SWT.READ_ONLY
| SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
GridData descriptionGridData = new GridData(GridData.FILL_VERTICAL);
descriptionGridData.widthHint = 200;
descriptionArea.setLayoutData(descriptionGridData);
Iterator<FileTemplateConfig> templateIterator = templateConfigMap.values().iterator();
while(templateIterator.hasNext()) {
String templateName = templateIterator.next().getName();
if(templateName.length() > 0) {
templateList.add(templateName);
}
}
if(templateList.getItemCount() == 0) {
ExceptionHandler.throwCoreException("templates.xml misses the required data!", null);
}
templateList.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
selectedTemplate = templateList.getItem(templateList.getSelectionIndex()).trim();
descriptionArea.setText(getTemplateDescription());
}
});
templateList.setSelection(0);
selectedTemplate = templateList.getItem(templateList.getSelectionIndex()).trim();
descriptionArea.setText(getTemplateDescription());
}