public void loadGraphIntoViewer(Graph gGraph)
 {
     try
     {
         fgdGraphData = new O2Graph.GraphData(gGraph);
         Int32.TryParse(tbMaxToPlot.Text, out fgdGraphData.iMaxToPlot);
         if (applyFiltersToGraph(fgdGraphData.gGraph, true) && cbDrawGleeGraph.Checked)
         {
             gvSmartTrace.Graph = fgdGraphData.gGraph;
         }
     }
     catch (Exception ex)
     {
         DI.log.error("in loadGraphIntoViewer: {0}", ex.Message);
     }
 }
        public void showO2GraphData(O2Graph.GraphData fgdGraphData)
        {
            lboxNodes.Items.Clear();
            foreach (DictionaryEntry deNode in fgdGraphData.gGraph.NodeMap)
            {
                var nNode = (Node)deNode.Value;
                if (false == lboxNodes.Items.Contains(nNode.Attr.Label))
                {
                    lboxNodes.Items.Add(nNode.Attr.Label);
                }
            }

            lBoxEdges.Items.Clear();
            foreach (Edge eEdge in fgdGraphData.gGraph.Edges)
            {
                if (false == lBoxEdges.Items.Contains(eEdge.ToString()))
                {
                    // lBoxEdges.Items.Add(eEdge.ToString());
                    lBoxEdges.Items.Add(eEdge.Target);
                }
            }
        }
        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);
        }