GetSyntaxNode() private method

private GetSyntaxNode ( ) : CommonSyntaxNode
return CommonSyntaxNode
        // Display deserialized SyntaxTree / SyntaxNode / SyntaxToken / SyntaxTrivia.
        internal void Display(SyntaxTransporter transporter)
        {
            if (transporter != null)
            {
                var node = transporter.GetSyntaxNode();
                const string ErrorMessage =
            @"The visualizer failed to correctly serialize / deserialize the
            object that you are trying to visualize. The information
            currently being displayed in the visualizer may be incorrect.

            The root cause could be one of the following -

            1. You are trying to visualize a 'top-level' SyntaxToken /
            SyntaxTrivia that was generated using Roslyn Syntax Factory
            Methods. This is not supported currently.

            - OR -

            2. There is a bug in Roslyn Syntax APIs that is causing the
            serialization / deserialization to fail.";

                if (node == null)
                {
                    HandleError(ErrorMessage);
                }
                else
                {
                    // Populate textbox with source code.
                    codeTextBox.Text = node.ToFullString();

                    // Populate treeview.
                    syntaxVisualizer.DisplaySyntaxNode(node, transporter.SourceLanguage);

                    // In the textbox, select the text corresponding to the SyntaxNode / SyntaxToken /
                    // SyntaxTrivia being debugged.
                    SelectText(transporter.ItemSpan.Start, transporter.ItemSpan.Length);

                    // In the treeview, select the SyntaxNode / SyntaxToken / SyntaxTrivia being debugged.
                    if (!syntaxVisualizer.NavigateToBestMatch(transporter.ItemSpan,
                                                              transporter.ItemKind,
                                                              transporter.ItemCategory,
                                                              highlightMatch: true,
                                                              highlightLegendDescription: "Under Inspection"))
                    {
                        // Display error message if the SyntaxNode / SyntaxToken / SyntaxTrivia
                        // being debugged was not found in the tree.
                        HandleError(ErrorMessage);
                    }
                }
            }
        }
        // Display deserialized SyntaxTree / SyntaxNode / SyntaxToken / SyntaxTrivia.
        internal void Display(SyntaxTransporter transporter)
        {
            if (transporter != null)
            {
                var          node         = transporter.GetSyntaxNode();
                const string ErrorMessage =
                    @"The visualizer failed to correctly serialize / deserialize the
object that you are trying to visualize. The information
currently being displayed in the visualizer may be incorrect.

The root cause could be one of the following -

1. You are trying to visualize a 'top-level' SyntaxToken /
SyntaxTrivia that was generated using Roslyn Syntax Factory
Methods. This is not supported currently.

- OR -

2. There is a bug in Roslyn Syntax APIs that is causing the
serialization / deserialization to fail.";

                if (node == null)
                {
                    HandleError(ErrorMessage);
                }
                else
                {
                    // Populate textbox with source code.
                    codeTextBox.Text = node.ToFullString();

                    // Populate treeview.
                    syntaxVisualizer.DisplaySyntaxNode(node, transporter.SourceLanguage);

                    // In the textbox, select the text corresponding to the SyntaxNode / SyntaxToken /
                    // SyntaxTrivia being debugged.
                    SelectText(transporter.ItemSpan.Start, transporter.ItemSpan.Length);

                    // In the treeview, select the SyntaxNode / SyntaxToken / SyntaxTrivia being debugged.
                    if (!syntaxVisualizer.NavigateToBestMatch(transporter.ItemSpan,
                                                              transporter.ItemKind,
                                                              transporter.ItemCategory,
                                                              highlightMatch: true,
                                                              highlightLegendDescription: "Under Inspection"))
                    {
                        // Display error message if the SyntaxNode / SyntaxToken / SyntaxTrivia
                        // being debugged was not found in the tree.
                        HandleError(ErrorMessage);
                    }
                }
            }
        }