Example #1
0
        private void toolStripButtonRuleRef_Click(object sender, EventArgs e)
        {
            TreeNode           tnSelect = this.treeViewTemplate.SelectedNode;
            DocModelRuleEntity docRule  = (DocModelRuleEntity)tnSelect.Tag as DocModelRuleEntity;

            if (docRule == null)
            {
                return;
            }

            DocEntity docEntity = this.m_project.GetDefinition(docRule.Name) as DocEntity;

            if (docEntity == null)
            {
                return;
            }

            using (FormSelectTemplate form = new FormSelectTemplate(null, this.Project, docEntity))
            {
                if (form.ShowDialog(this) == DialogResult.OK && form.SelectedTemplate != null)
                {
                    // check for possible recursion
                    if (form.SelectedTemplate == this.m_template || form.SelectedTemplate.IsTemplateReferenced(this.m_template))
                    {
                        MessageBox.Show("Recursive template referencing is not supported.");
                        return;
                    }

                    docRule.References.Add(form.SelectedTemplate);

                    LoadTemplateGraph(tnSelect, docRule);
                }
            }
        }
Example #2
0
        private void toolStripButtonConceptTemplate_Click(object sender, EventArgs e)
        {
            DocTemplateDefinition docTemplate = null;

            if (this.m_conceptleaf != null)
            {
                docTemplate = this.m_conceptleaf.Definition;
            }
            else
            {
                docTemplate = this.m_conceptroot.ApplicableTemplate;
            }

            using (FormSelectTemplate form = new FormSelectTemplate(docTemplate, this.m_project, this.m_conceptroot.ApplicableEntity))
            {
                if (form.ShowDialog(this) == DialogResult.OK && form.SelectedTemplate != null)
                {
                    if (this.m_conceptleaf != null)
                    {
                        this.m_conceptleaf.Definition = form.SelectedTemplate;
                        this.m_conceptleaf.Items.Clear();
                    }
                    else
                    {
                        this.m_conceptroot.ApplicableTemplate = form.SelectedTemplate;
                        this.m_conceptroot.ApplicableItems.Clear();
                    }

                    this.LoadUsage();
                    this.LoadInheritance();
                }
            }
        }
Example #3
0
        private void toolStripButtonConceptTemplate_Click(object sender, EventArgs e)
        {
            using (FormSelectTemplate form = new FormSelectTemplate(this.m_conceptleaf.Definition, this.m_project, this.m_conceptroot.ApplicableEntity))
            {
                if (form.ShowDialog(this) == DialogResult.OK && form.SelectedTemplate != null)
                {
                    this.m_conceptleaf.Definition = form.SelectedTemplate;
                    this.m_conceptleaf.Items.Clear();

                    //this.textBoxConceptTemplate.Text = this.m_conceptleaf.Definition.Name;
                }
            }
        }
Example #4
0
        private void toolStripButtonTemplate_Click(object sender, EventArgs e)
        {
            DocEntity docBaseEntity = this.m_project.GetDefinition(this.m_template.Type) as DocEntity;

            if (this.m_conceptroot != null && this.m_conceptroot.ApplicableEntity != null)
            {
                docBaseEntity = this.m_conceptroot.ApplicableEntity;
            }

            using (FormSelectTemplate form = new FormSelectTemplate(this.Template, this.m_project, docBaseEntity))
            {
                if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    this.ChangeTemplate(form.SelectedTemplate);
                }
            }
        }
Example #5
0
        private void buttonUsageMigrate_Click(object sender, EventArgs e)
        {
            DocTemplateDefinition docTemplate = (DocTemplateDefinition)this.m_target;
            DocEntity docEntity = (DocEntity)this.m_map[docTemplate.Type];

            using (FormSelectTemplate form = new FormSelectTemplate(docTemplate, this.m_project, null))
            {
                DialogResult res = form.ShowDialog(this);
                if (res == System.Windows.Forms.DialogResult.OK && form.SelectedTemplate != null && form.SelectedTemplate != docTemplate)
                {
                    while (this.listViewUsage.SelectedItems.Count > 0)
                    {
                        ListViewItem lvi = this.listViewUsage.SelectedItems[0];
                        DocObject[] path = (DocObject[])lvi.Tag;
                        if (path.Length == 3)
                        {
                            DocTemplateUsage usage = (DocTemplateUsage)path[2];
                            usage.Definition = form.SelectedTemplate;

                            lvi.Remove();
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
        }
Example #6
0
        private void buttonApplicabilityAddTemplate_Click(object sender, EventArgs e)
        {
            using (FormSelectTemplate form = new FormSelectTemplate(null, this.m_project, null))
            {
                if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK && form.SelectedTemplate != null)
                {
                    DocExample docExample = (DocExample)this.m_target;
                    docExample.ApplicableTemplates.Add(form.SelectedTemplate);

                    this.LoadApplicability();
                }
            }
        }
Example #7
0
        private void toolStripButtonConceptTemplate_Click(object sender, EventArgs e)
        {
            using (FormSelectTemplate form = new FormSelectTemplate(this.m_conceptleaf.Definition, this.m_project, this.m_conceptroot.ApplicableEntity))
            {
                if (form.ShowDialog(this) == DialogResult.OK && form.SelectedTemplate != null)
                {
                    this.m_conceptleaf.Definition = form.SelectedTemplate;
                    this.m_conceptleaf.Items.Clear();

                    //this.textBoxConceptTemplate.Text = this.m_conceptleaf.Definition.Name;
                }
            }
        }
Example #8
0
        private void toolStripButtonRuleRef_Click(object sender, EventArgs e)
        {
            TreeNode tnSelect = this.treeViewTemplate.SelectedNode;
            DocModelRuleEntity docRule = (DocModelRuleEntity)tnSelect.Tag as DocModelRuleEntity;
            if (docRule == null)
                return;

            DocEntity docEntity = this.m_project.GetDefinition(docRule.Name) as DocEntity;
            if (docEntity == null)
                return;

            using (FormSelectTemplate form = new FormSelectTemplate(null, this.Project, docEntity))
            {
                if (form.ShowDialog(this) == DialogResult.OK && form.SelectedTemplate != null)
                {
                    // check for possible recursion
                    if(form.SelectedTemplate == this.m_template || form.SelectedTemplate.IsTemplateReferenced(this.m_template))
                    {
                        MessageBox.Show("Recursive template referencing is not supported.");
                        return;
                    }

                    docRule.References.Add(form.SelectedTemplate);

                    LoadTemplateGraph(tnSelect, docRule);
                }
            }
        }
Example #9
0
        private void toolStripButtonConceptTemplate_Click(object sender, EventArgs e)
        {
            DocTemplateDefinition docTemplate = null;
            if (this.m_conceptleaf != null)
            {
                docTemplate = this.m_conceptleaf.Definition;
            }
            else
            {
                docTemplate = this.m_conceptroot.ApplicableTemplate;
            }

            using (FormSelectTemplate form = new FormSelectTemplate(docTemplate, this.m_project, this.m_conceptroot.ApplicableEntity))
            {
                if (form.ShowDialog(this) == DialogResult.OK && form.SelectedTemplate != null)
                {
                    if (this.m_conceptleaf != null)
                    {
                        this.m_conceptleaf.Definition = form.SelectedTemplate;
                        this.m_conceptleaf.Items.Clear();
                    }
                    else
                    {
                        this.m_conceptroot.ApplicableTemplate = form.SelectedTemplate;
                        this.m_conceptroot.ApplicableItems.Clear();
                    }

                    this.LoadUsage();
                    this.LoadInheritance();
                }
            }
        }
Example #10
0
        private void toolStripMenuItemInsertUseDefinition_Click(object sender, EventArgs e)
        {
            DocConceptRoot docConceptRoot = this.treeView.SelectedNode.Tag as DocConceptRoot;
            if (docConceptRoot == null)
                return;

            DocEntity docEntity = (DocEntity)this.treeView.SelectedNode.Parent.Tag as DocEntity;
            if (docEntity == null)
                return;

            // browse for template
            using (FormSelectTemplate form = new FormSelectTemplate(null, this.m_project, docEntity))
            {
                DialogResult res = form.ShowDialog(this);
                if (res == DialogResult.OK && form.SelectedTemplate != null)
                {
                    // create
                    DocTemplateUsage docUsage = new DocTemplateUsage();
                    docConceptRoot.Concepts.Add(docUsage);
                    docUsage.Definition = form.SelectedTemplate;
                    docUsage.Name = docUsage.Definition.Name;
                    this.treeView.SelectedNode = LoadNode(this.treeView.SelectedNode, docUsage, docUsage.Name, false);
                }
            }
        }