Пример #1
0
        public void GoToDefinition(String token)
        {
            IdentificableObject io = (IdentificableObject)model.FindElementByName(token);

            if(io == null)
            {
                return;
            }

            if(io is GlossaryItem || io is Stakeholder)
            {
                frmModelBrowser.tvModelBrowser.SelectedNode = frmModelBrowser.tvModelBrowser.Nodes[0];
                frmModelBrowser.tvModelBrowser.Nodes[0].EnsureVisible();

                frmTabView frm;
                IDockContent content = this.FindDocument(model.Name);
                if (content != null)
                {
                    frm = (frmTabView)content.DockHandler.Form;
                    frm.Activate();
                }
                else
                {
                    frm = new frmTabView(
                        this,
                        model,
                        this.separators,
                        this.hdc,
                        this.localizer);
                    frm.Show(this.dockPanel, DockState.Document);
                }
                if(io is GlossaryItem)
                {
                    frm.ShowGlossaryItem(io.Name);
                }
                else
                {
                    frm.ShowStakeholder(io.Name);
                }
            }
            else
            {
                TreeNode node = this.FindNode(null, io.UniqueID);
                node.EnsureVisible();
                frmModelBrowser.tvModelBrowser.SelectedNode = node;
            }
        }
Пример #2
0
        private frmTabView ActivateDocument(object element)
        {
            this.Cursor = Cursors.WaitCursor;
            Icon icon = null;

            IDockContent content = this.FindDocument(((IdentificableObject)element).Name);
            if(content != null)
            {
                content.DockHandler.Activate();
                this.Cursor = Cursors.Default;
                return (frmTabView)content;
            }

            frmTabView frm = new frmTabView(
                this,
                element,
                this.separators,
                this.hdc,
                this.localizer);

            if(element.GetType() == typeof(Package) || element.GetType() == typeof(Model))
            {
                icon = Icon.FromHandle(((Bitmap)imgListModelBrowser.Images[0]).GetHicon());
            }
            if(element.GetType() == typeof(Actor))
            {
                icon = Icon.FromHandle(((Bitmap)imgListModelBrowser.Images[3]).GetHicon());
            }
            if(element.GetType() == typeof(UseCase))
            {
                icon = Icon.FromHandle(((Bitmap)imgListModelBrowser.Images[4]).GetHicon());
            }

            frm.Icon = (Icon)icon.Clone();
            Win32.DestroyIcon(icon.Handle);

            frm.Show(this.dockPanel, DockState.Document);
            frm.Activate();

            this.Cursor = Cursors.Default;

            return frm;
        }