private protected virtual string GetFocusedCommentText(IFocusCommentFocus commentFocus)
        {
            IFocusCommentCellView CellView = commentFocus.CellView;
            Document Documentation         = CellView.StateView.State.Node.Documentation;

            return(CommentHelper.Get(Documentation));
        }
        private protected virtual void ExtendSelectionComment(IFocusCommentSelection selection)
        {
            IFocusCommentFocus AsCommentFocus = Focus as IFocusCommentFocus;

            Debug.Assert(AsCommentFocus != null);
            string Text = GetFocusedCommentText(AsCommentFocus);

            Debug.Assert(selection.Start <= selection.End);

            int SelectedCount = selection.End - selection.Start;

            Debug.Assert(SelectedCount == Text.Length);

            SelectNode(selection.StateView.State);
        }
        /// <summary>
        /// Updates the focus chain with cells in the tree.
        /// </summary>
        /// <param name="focusChain">The list of focusable cell views found in the tree.</param>
        /// <param name="focusedNode">The currently focused node.</param>
        /// <param name="focusedFrame">The currently focused frame in the template associated to <paramref name="focusedNode"/>.</param>
        /// <param name="matchingFocus">The focus in <paramref name="focusChain"/> that match <paramref name="focusedNode"/> and <paramref name="focusedFrame"/> upon return.</param>
        public virtual void UpdateFocusChain(IFocusFocusList focusChain, INode focusedNode, IFocusFrame focusedFrame, ref IFocusFocus matchingFocus)
        {
            IFocusCommentFocus NewFocus = CreateFocus();

            focusChain.Add(NewFocus);

            if (focusedFrame == Frame)
            {
                IFocusOptionalNodeState AsOptionalNodeState = StateView.State as IFocusOptionalNodeState;
                Debug.Assert(AsOptionalNodeState == null || AsOptionalNodeState.ParentInner.IsAssigned);

                if (focusedNode == StateView.State.Node)
                {
                    Debug.Assert(matchingFocus == null);
                    matchingFocus = NewFocus;
                }
            }
        }