Exemplo n.º 1
0
        public void OpenMember(AssemblyTreeMember member)
        {
            if (member.Member is IMemberInfo)
            {
                IMemberInfo memberInfo = (IMemberInfo)member.Member;
                FileManager.GoToDefinition(memberInfo);

                // TODO: remove threading!

                if (memberInfo.SF == this.fileManager.CurrentFile)
                {
                    this.assemblyTreeView.CurrentNode = member;
                    this.assemblyTreeView.RefreshSelectedNode(false);
                }
            }
            else if (member.Member is IReferenceInfo)
            {
                IReferenceInfo referenceInfo = (IReferenceInfo)member.Member;
                FileManager.GoToPosition(referenceInfo.SF, referenceInfo.CharIndex, referenceInfo.CharLength, referenceInfo);

                if (referenceInfo.SF == this.fileManager.CurrentFile)
                {
                    this.assemblyTreeView.CurrentNode = member;
                    this.assemblyTreeView.RefreshSelectedNode(false);
                }
            }
        }
Exemplo n.º 2
0
        public void SelectMemberInTree(IReferenceInfo refInfo)
        {
            AssemblyTreeFile file = this.assemblyTreeView.FindFile(refInfo.SF);

            if (file != null)
            {
                AssemblyTreeMember m = file.Find(refInfo);

                this.assemblyTreeView.CurrentNode = m;
                this.assemblyTreeView.RefreshSelectedNode(false);
            }
        }
Exemplo n.º 3
0
        public void SelectMemberInTree(IMemberInfo member)
        {
            AssemblyTreeFile file = this.assemblyTreeView.FindFile(member.SF);

            if (file != null)
            {
                AssemblyTreeMember m = file.Find(member);

                this.assemblyTreeView.CurrentNode = m;
                this.assemblyTreeView.RefreshSelectedNode(false);
            }
        }
Exemplo n.º 4
0
        public ReferenceContextMenuStrip(AssemblyTreeMember member, IReferenceInfo refInfo)
        {
            _member  = member;
            _refInfo = refInfo;

            ToolStripMenuItem refGoToReference = new ToolStripMenuItem("Go To Reference");

            refGoToReference.Click += new EventHandler(refGoToReference_Click);

            ToolStripMenuItem refGoToDefinition = new ToolStripMenuItem("Go To Definition");

            refGoToDefinition.Click += new EventHandler(refGoToDefinition_Click);

            this.Items.AddRange(new ToolStripMenuItem[] { refGoToReference, refGoToDefinition });
        }
Exemplo n.º 5
0
        public MemberContextMenuStrip(AssemblyTreeMember member, IMemberInfo memberInfo)
        {
            _member     = member;
            _memberInfo = memberInfo;

            ToolStripMenuItem memberGoToDefinition = new ToolStripMenuItem("Go To Definition");

            memberGoToDefinition.Click += new EventHandler(memberGoToDefinition_Click);

            ToolStripMenuItem memberFindAllReferences = new ToolStripMenuItem("Find All References");

            memberFindAllReferences.Click += new EventHandler(memberFindAllReferences_Click);

            ToolStripMenuItem memberCopy = new ToolStripMenuItem("Copy");

            memberCopy.Click += new EventHandler(memberCopy_Click);

            this.Items.AddRange(new ToolStripMenuItem[] { memberGoToDefinition, memberFindAllReferences, memberCopy });
        }
Exemplo n.º 6
0
        public void Add(AssemblyTreeMember member)
        {
            if (member.Member is ConstInfo)
            {
                _constants.Add(member);
            }
            else if (member.Member is FuncInfo)
            {
                _functions.Add(member);
            }
            else if (member.Member is UsingInfo)
            {
                _usings.Add(member);
            }
            else
            {
                _members.Add(member);
            }

            member.ParentFile = this;

            anyUpdate = true;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Expand node and all his parents and collapse lastNode and all his parents
        /// </summary>
        /// <param name="node">TreeNode to expand</param>
        /// <param name="lastNode">TreeNode to collapse</param>
        private void ExpandNodeRecursive(TreeNode curNode, TreeNode lastNode)
        {
            // DO THE MAGIC :)

            AssemblyTreeMember curMember  = curNode as AssemblyTreeMember;
            AssemblyTreeMember lastMember = lastNode as AssemblyTreeMember;

            if (curMember != null && lastMember != null)
            {
                if (curMember != lastMember)
                {
                    ExpandNodeRecursive(curMember.ParentFile, lastMember.ParentFile);
                }

                return;
            }
            else if (curMember != null)
            {
                ExpandNodeRecursive(curMember.ParentFile, lastNode);
                return;
            }
            else if (lastMember != null)
            {
                ExpandNodeRecursive(curNode, lastMember.ParentFile);
                return;
            }

            AssemblyTreeFile curFile  = curNode as AssemblyTreeFile;
            AssemblyTreeFile lastFile = lastNode as AssemblyTreeFile;

            if (curFile != null && lastFile != null)
            {
                if (curFile != lastFile)
                {
                    Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Collapsing " + lastFile.Text);
                    lastFile.Collapse();

                    ExpandNodeRecursive(curFile.ParentFolder, lastFile.ParentFolder);

                    Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Expanding " + curFile.Text);
                    curFile.Expand();
                }
                else
                {
                    if (!curFile.IsExpanded)
                    {
                        Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Expanding " + curFile.Text);
                        curFile.Expand();
                    }
                }
                return;
            }
            else if (curFile != null)
            {
                ExpandNodeRecursive(curFile.ParentFolder, lastNode);

                Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Expanding " + curFile.Text);
                curFile.Expand();
                return;
            }
            else if (lastFile != null)
            {
                Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Collapsing " + lastFile.Text);
                lastFile.Collapse();

                ExpandNodeRecursive(curNode, lastFile.ParentFolder);
                return;
            }

            AssemblyTreeFolder curFolder  = curNode as AssemblyTreeFolder;
            AssemblyTreeFolder lastFolder = lastNode as AssemblyTreeFolder;

            if (curFolder != null && !curFolder.IsRootFolder &&
                lastFolder != null && !lastFolder.IsRootFolder)    // collapse last, expand current
            {
                //if (curFolder != lastFolder) // has not expanded yet
                //{
                if (curFolder.Level > lastFolder.Level)
                {
                    ExpandNodeRecursive(curFolder.ParentFolder, lastFolder);

                    if (!curFolder.IsExpanded)
                    {
                        Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Expanding " + curFolder.Text);
                        curFolder.Expand();
                    }
                }
                else if (curFolder.Level < lastFolder.Level)
                {
                    Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Collapsing " + lastFolder.Text);
                    lastFolder.Collapse();

                    ExpandNodeRecursive(curFolder, lastFolder.ParentFolder);
                }
                else
                {
                    if (curFolder != lastFolder)
                    {
                        Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Collapsing " + lastFolder.Text);
                        lastFolder.Collapse();
                    }

                    ExpandNodeRecursive(curFolder.ParentFolder, lastFolder.ParentFolder);

                    if (!curFolder.IsExpanded)
                    {
                        Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Expanding " + curFolder.Text);
                        curFolder.Expand();
                    }
                }
                //}
                return;
            }
            else if (curFolder != null && !curFolder.IsRootFolder) // expand current
            {
                ExpandNodeRecursive(curFolder.ParentFolder, lastNode);

                Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Expanding " + curFolder.Text);
                curFolder.Expand();
                return;
            }
            else if (lastFolder != null && !lastFolder.IsRootFolder) // collapse last
            {
                Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "Collapsing " + lastFolder.Text);
                lastFolder.Collapse();

                ExpandNodeRecursive(curNode, lastFolder.ParentFolder);
                return;
            }
        }