public TemplateRenderModel Render(FileModel fileModel)
        {
            TemplateRenderModel result = new TemplateRenderModel();
            result.Structure = sourceStructure;
            result.FileModel = fileModel;

            StringBuilder templateBuilder = new StringBuilder();
            templateBuilder.Append("group Group1;");
            templateBuilder.Append("RenderFile(file) ::= <<");
            templateBuilder.Append(sourceStructure.FileTemplate);
            templateBuilder.Append(">>");
            templateBuilder.Append("RenderNamespace(namespace) ::= <<");
            templateBuilder.Append(sourceStructure.NamespaceTemplate);
            templateBuilder.Append(">>");
            templateBuilder.Append("RenderEntity(entity) ::= <<");
            templateBuilder.Append(sourceStructure.EntityTemplate);
            templateBuilder.Append(">>");

            using (TextReader sr = new StringReader(templateBuilder.ToString()))
            {
                Antlr3.ST.StringTemplateGroup groups = new Antlr3.ST.StringTemplateGroup(sr, typeof(Antlr3.ST.Language.TemplateLexer));

                Antlr3.ST.StringTemplate template = groups.GetInstanceOf("RenderFile");
                template.SetAttribute("file", fileModel);

                result.Result = template.ToString();
            }

            return result;
        }
        public void SetModel(FileModel model)
        {
            if (model != null)
            {
                this.model = model;
                bsImports.DataSource = model.Imports;
                bsNamespace.DataSource = model.Namespaces;
            }
            else
            {
                this.model = null;
                bsImports.DataSource = null;
                bsNamespace.DataSource = null;
            }

            bsImports.ResetBindings(false);
            bsNamespace.ResetBindings(false);

            listNamespaces.DisplayMember = "Name.PascalCase";
            listImports.DataSource = bsImports;
            listNamespaces.DataSource = bsNamespace;
        }