public void executeAction_onFunctionSelect(Node nSelectedNode)
        {
            if (rbOnFunctionSelect_Show.Checked)
            {
                Int32 iNameSpaceDepth;
                Int32.TryParse(cBoxShowFunctionClass_Depth.Text, out iNameSpaceDepth);
                nSelectedNode.NodeAttribute.Label = FilteredSignature.filterSignature(nSelectedNode.Id,
                                                                                      cbGLEE_ShowParameters.Checked,
                                                                                      cbGLEE_ShowReturnClass.Checked,
                                                                                      cbGLEE_ShowNamespace.Checked,
                                                                                      iNameSpaceDepth);
                nSelectedNode.NodeAttribute.Shape = Shape.Box;
            }
            else if (rbOnFunctionSelect_Clear.Checked)
            {
                O2Graph.makeEmptyNode(nSelectedNode);
            }
            else if (rbOnFunctionSelect_Remove.Checked)
            {
                O2Graph.deleteNodeFromGraph(fgdGraphData, nSelectedNode, true);
            }
            else if (rbOnFunctionSelect_HighlightAllCalls_To.Checked)
            {
                applyFiltersToGraph(fgdGraphData.gGraph, true);
                highlighCallsToNode_Recursive(nSelectedNode);
                highlighCallsFromNode_Recursive(nSelectedNode);
            }
            else
            {
            }
            //else if (rbOnFunctionSelect_SClear.Checked)

            /*
             */
        }
        public Graph getGraphWithAllNodesInTreeView()
        {
            bool bCachedValue_CheckBox_VisibleControls_GraphStats = cbVisibleControls_GraphStats.Checked;

            cbVisibleControls_GraphStats.Checked = false;
            var gMainGraph = new Graph("SmartTrace with all Nodes");

            foreach (TreeNode tnTreeNodeToGraph in tvGLEE_NodesToGraph.Nodes)
            {
                int iEdgeId   = 0;
                var gSubGraph = new Graph(tnTreeNodeToGraph.ToString());
                //graph.populateGraphWithTreeNode(ref iEdgeId, gGraph, tnTreeNodeToGraph, cbGLEE_order.Checked);
                O2Graph.populateGraphWithTreeNode(ref iEdgeId, gSubGraph, tnTreeNodeToGraph, cbGLEE_order.Checked);
                applyFiltersToGraph(gSubGraph, false);
                O2Graph.addGraphToGraph(gSubGraph, gMainGraph);
            }
            // finally process graph with all traces
            //      this.applyFiltersToGraph(gMainGraph, false);
            if (bCachedValue_CheckBox_VisibleControls_GraphStats)
            {
                cbVisibleControls_GraphStats.Checked = bCachedValue_CheckBox_VisibleControls_GraphStats;
                //        gdmcrGraphDataMappedToCustomRules.showO2GraphData(this.fgdGraphData);
            }
            return(gMainGraph);
        }
        public void loadSmartTraceGraphInGleeViewer(bool bLoadAllTraces)
        {
            if (fadAssessmentDataOunceV6 == null)
            {
                DI.log.error("in loadSmartTraceGraphInGleeViewer this.fadO2AssessmentData == null");
                return;
            }
            //if (tvGLEE_NodesToGraph.Nodes.Count > 0)
            //{
            populateComboBoxWithGleeNodeShapes();

            Graph gGraph;

            //gvSmartTrace.Graph.Cluster = cbGLEE_test.Checked;  // doesn't seem to have an impact (need to check what this does)

            if (bLoadAllTraces)
            {
                gGraph = getGraphWithAllNodesInTreeView();
            }
            else
            {
                gGraph = getGraphWithSelectedNodesInTreeView();
            }

            if (cbGLEE_ConsolidateTraces.Checked)
            {
                O2Graph.createGraphWithConsolidatedPaths(ref gGraph);
            }
            loadGraphIntoViewer(gGraph);
            //}
        }
 private void btRemoveSelectedNode_Click(object sender, EventArgs e)
 {
     if (nPreviouslySelectedNode != null)
     {
         //String sTy = nPreviouslySelectedNode.GetType().Name;
         O2Graph.deleteNodeFromGraph(fgdGraphData, nPreviouslySelectedNode, true);
         loadGraph(fgdGraphData.gGraph);
         //Node nSelectedNode
     }
 }
        public Graph getGraphWithSelectedNodesInTreeView()
        {
            var gGraph = new Graph("SmartTrace with Selected Nodes");

            if (tvGLEE_NodesToGraph.SelectedNode != null)
            {
                int iEdgeId = 0;
                O2Graph.populateGraphWithTreeNode(ref iEdgeId, gGraph, tvGLEE_NodesToGraph.SelectedNode,
                                                  cbGLEE_order.Checked);
            }
            return(gGraph);
        }
        private void btRemoveNodes_NotSelected_Click(object sender, EventArgs e)
        {
            gvSmartTrace.Graph = new Graph("temp graph");
            var lNodesToDelete = new List <Node>();

            foreach (Node nNode in fgdGraphData.dNodes.Values)
            {
                if (nNode.NodeAttribute.Fillcolor == Color.White)
                {
                    lNodesToDelete.Add(nNode);
                }
            }
            foreach (Node nNode in lNodesToDelete)
            {
                O2Graph.deleteNodeFromGraph(fgdGraphData, nNode, true);
            }
            loadGraph(fgdGraphData.gGraph);
        }
        public bool applyFiltersToGraph(Graph gGraph, bool bVerbose)
        {
            try
            {
                int iNamespaceDepth = Int32.Parse(cBoxShowFunctionClass_Depth.Text);
                O2Graph.applyStylesAndFiltersToGraph(
                    gGraph,
                    (Shape)cbGlee_NodeShape.SelectedItem,
                    fadAssessmentDataOunceV6,
                    cbLDDB_ShowInsideNode_MethodName.Checked,
                    cbGLEE_ShowParameters.Checked,
                    cbGLEE_ShowReturnClass.Checked,
                    cbGLEE_ShowNamespace.Checked,
                    iNamespaceDepth,
                    cbLDDB_ShowInsideNode_Context.Checked,
                    cbLDDB_ShowInsideNode_SourceCode.Checked,
                    cbOnlyShowDataFor_SourcesAndSinks.Checked);


                if (cbOnlyShowDataFor_Class.Checked)
                {
                    O2Graph.onlyShowNodesContainingClass(gGraph, tbOnlyShowDataFor_Class.Text);
                }

                fgdGraphData = new O2Graph.GraphData(gGraph);
                //tbMaxToPlot.Text = fgdGraphData.iMaxToPlot.ToString();
                Int32.TryParse(tbMaxToPlot.Text, out fgdGraphData.iMaxToPlot);
                fgdGraphData.iItemsToRemove = Int32.Parse(cbConsolidateDepth.Text);
                // -1 means all (used to debug graph building

                if (cbOnlyShowDataFor_LostSources.Checked)
                {
                    O2Graph.makeLostSourcesVisible(fgdGraphData, cbGLEE_ShowParameters.Checked,
                                                   cbGLEE_ShowReturnClass.Checked, cbGLEE_ShowNamespace.Checked,
                                                   iNamespaceDepth);
                }
                if (cbOnlyShowDataFor_ConsolidateNonVisibleNodes.Checked)
                {
                    O2Graph.consolidateNonVisibleNodes(fgdGraphData, bVerbose);
                }
                if (bVerbose)
                {
                    DI.log.info("New Graph object Created: : Nodes={0}, Edges={1}", fgdGraphData.gGraph.NodeCount,
                                fgdGraphData.gGraph.EdgeCount);
                }
                if (cbVisibleControls_GraphStats.Checked)
                {
                    gdmcrGraphDataMappedToCustomRules.showO2GraphData(fgdGraphData);
                }
                if (fgdGraphData.gGraph.NodeCount + fgdGraphData.gGraph.EdgeCount > fgdGraphData.iMaxToPlot)
                {
                    DI.log.error("To many nodes and edges to view in Glee : Nodes={0}, Edges={1}, MaxToPlot={2}",
                                 fgdGraphData.gGraph.NodeCount, fgdGraphData.gGraph.EdgeCount,
                                 fgdGraphData.iMaxToPlot);
                    // clearGraph();
                    // fgdGraphData.gGraph = new Graph("To many nodes");
                    var nAlertNode =
                        (Node)
                        fgdGraphData.gGraph.AddNode(
                            "To many nodes to view - \n NOT ALL NODES WHERE SHOWN \n (add filters to reduce working set)");
                    nAlertNode.NodeAttribute.Fillcolor = Color.Red;
                    fgdGraphData.bShouldGraphBeShown   = false;
                }
            }
            catch (Exception ex)
            {
                DI.log.error("in applyFiltersToGraph: {0}", ex.Message);
            }
            return(fgdGraphData.bShouldGraphBeShown);
        }