private void LoadTree()
{
this.treeView.Nodes.Clear();
this.m_mapTree.Clear();
if (this.m_project == null)
return;
// now populate tree
foreach (DocSection section in this.m_project.Sections)
{
TreeNode tn = LoadNode(null, section, section.Name, false);
if (this.m_project.Sections.IndexOf(section) == 0)
{
// model views
if (this.m_project.ModelViews != null)
{
foreach (DocModelView docModel in this.m_project.ModelViews)
{
TreeNode tnModel = LoadNode(tn, docModel, docModel.Name, true);
foreach (DocExchangeDefinition docExchange in docModel.Exchanges)
{
LoadNode(tnModel, docExchange, docExchange.Name, false);
}
//temp: also load concept roots
#if false
foreach(DocConceptRoot docCR in docModel.ConceptRoots)
{
LoadNode(tnModel, docCR, docCR.ApplicableEntity.Name, false);
}
#endif
}
}
}
if (this.m_project.Sections.IndexOf(section)== 1)
{
if(this.m_project.NormativeReferences != null)
{
foreach(DocReference docRef in this.m_project.NormativeReferences)
{
LoadNode(tn, docRef, docRef.Name, true);
}
}
}
if (this.m_project.Sections.IndexOf(section) == 2)
{
//TreeNode tnTerms = LoadNode(tn, typeof(DocTerm), "Terms", false);
if (this.m_project.Terms != null)
{
foreach (DocTerm docTerm in this.m_project.Terms)
{
LoadTreeTerm(tn, docTerm);
}
}
//TreeNode tnAbbrev = LoadNode(tn, typeof(DocAbbreviation), "Abbreviations", false);
if (this.m_project.Abbreviations != null)
{
foreach (DocAbbreviation docTerm in this.m_project.Abbreviations)
{
LoadNode(tn, docTerm, docTerm.Name, true);
}
}
}
// special case for section 4 -- show templates and views
if (this.m_project.Sections.IndexOf(section) == 3)
{
// templates
if (this.m_project.Templates != null && this.m_project.Templates.Count > 0)
{
foreach (DocTemplateDefinition docTemplate in this.m_project.Templates)
{
LoadTreeTemplate(tn, docTemplate);
}
}
}
foreach (DocSchema schema in section.Schemas)
{
TreeNode tnSchema = LoadNode(tn, schema, schema.Name, true);
LoadNodeSchema(tnSchema, schema);
}
}
foreach (DocAnnex annex in this.m_project.Annexes)
{
TreeNode tn = LoadNode(null, annex, annex.Name, false);
if (this.m_project.Annexes.IndexOf(annex) == 4 && this.m_project.Examples != null)
{
// special case for examples
foreach (DocExample docExample in this.m_project.Examples)
{
TreeNode tnEx = LoadNode(tn, docExample, docExample.Name, true);
if (docExample.Examples != null)
{
foreach (DocExample docSub in docExample.Examples)
{
LoadTreeExample(tnEx, docSub);
}
}
}
}
if (this.m_project.Annexes.IndexOf(annex) == 5 && this.m_project.ChangeSets != null)
{
// special case for change logs
foreach (DocChangeSet docChangeSet in this.m_project.ChangeSets)
{
TreeNode tnSet = LoadNode(tn, docChangeSet, docChangeSet.Name, true);
foreach (DocChangeAction docChangeItem in docChangeSet.ChangesEntities)
{
LoadTreeChange(tnSet, docChangeItem);
}
}
}
}
// bibliography
TreeNode tnBibliography = LoadNode(null, typeof(DocReference), "Bibliography", false);
if(this.m_project.InformativeReferences != null)
{
foreach (DocReference docRef in this.m_project.InformativeReferences)
{
LoadNode(tnBibliography, docRef, docRef.Name, true);
}
}
// new: publication
TreeNode tnPublication = LoadNode(null, typeof(DocPublication), "Publications", false);
foreach(DocPublication docPub in this.m_project.Publications)
{
TreeNode tnPub = LoadNode(tnPublication, docPub, docPub.Name, false);
foreach (DocAnnotation docAnno in docPub.Annotations)
{
LoadNode(tnPub, docAnno, docAnno.Name, false);
}
}
// force update of main pain
if (this.treeView.Nodes.Count > 0)
{
this.treeView.SelectedNode = this.treeView.Nodes[0];
}
}