예제 #1
0
        public void addCallerAndCalleesToGraphNode(WPF.Control graphNode, string methodSignature)
        {
            if (graphNode != null && methodSignature.valid())
            {
                if (ExpandMethodsCalled)
                {
                    if (this.MethodsCalledMappings.hasKey(methodSignature))
                    {
                        foreach (var methodCalled in this.MethodsCalledMappings[methodSignature])
                        {
                            //if (GraphNodes.hasKey(methodCalled).isFalse())
                            GraphViewer.add_Edge(graphNode, createGraphNode(methodCalled));
                        }
                    }
                }
                if (ExpandMethodIsCalledBy)
                {
                    if (MethodIsCalledByMappings.hasKey(methodSignature))
                    {
                        foreach (var methodIsCalledBy in this.MethodIsCalledByMappings[methodSignature])
                        {
                            //if (GraphNodes.hasKey(methodIsCalledBy).isFalse())
                            GraphViewer.add_Edge(createGraphNode(methodIsCalledBy), graphNode);
                        }
                    }
                }

                WPF_Controls_ExtensionMethods_Control.color(graphNode, "Green");
            }
        }
예제 #2
0
        public WPF.Control createGraphNode(string methodSignature)
        {
            if (GraphNodes.hasKey(methodSignature))
            {
                return(GraphNodes[methodSignature]);
            }

            var graphNode = GraphViewer.newInThread <WPF.Label>();
            var iMethod   = AstData.iMethod_withSignature(methodSignature);

            if (iMethod != null)
            {
                //this.GraphModeRightPanels[0].clear();
                //GraphViewer = this.GraphModeRightPanels[0].add_Graph();
                graphNode.set_Content(iMethod.Name);
                //graphNode.set_Tag(iMethod);
                WPF_Controls_ExtensionMethods_Control.color(graphNode, "Black");                 // direct call throws compile error -> graphNode.color("Black");
            }
            else
            {
                WPF_Controls_ExtensionMethods_Control.color(graphNode, "Red");
                graphNode.set_Content(methodSignature);
            }
            if (UseStarAsNodeText)
            {
                graphNode.set_Content("*");
            }
            graphNode.set_Tag(methodSignature);

            graphNode.onMouseDoubleClick <string, WPF.Label>(
                (signature) => {
                addCallerAndCalleesToGraphNode(graphNode, signature);
            });

            GraphNodes.add(methodSignature, graphNode);
            return(graphNode);
        }