//=====================================================================

        /// <summary>
        /// This is used to get information from token and content layout files open in editors so that current
        /// information is displayed for them in the topic previewer control.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void ucTopicPreviewer_FileContentNeeded(object sender, FileContentNeededEventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            IVsUIShell uiShell = Utility.GetServiceFromPackage <IVsUIShell, SVsUIShell>(true);

            IVsWindowFrame[]        frames = new IVsWindowFrame[1];
            ContentLayoutEditorPane contentLayoutPane;
            TokenEditorPane         tokenFilePane;

            if (uiShell.GetDocumentWindowEnum(out IEnumWindowFrames enumFrames) == VSConstants.S_OK)
            {
                while (enumFrames.Next(1, frames, out uint frameCount) == VSConstants.S_OK && frameCount == 1)
                {
                    if (frames[0].GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out object docView) == VSConstants.S_OK)
                    {
                        contentLayoutPane = docView as ContentLayoutEditorPane;

                        if (contentLayoutPane != null)
                        {
                            e.ContentLayoutFiles.Add(contentLayoutPane.Filename, contentLayoutPane.Topics);
                        }
                        else
                        {
                            tokenFilePane = docView as TokenEditorPane;

                            if (tokenFilePane != null)
                            {
                                e.TokenFiles.Add(tokenFilePane.Filename, tokenFilePane.Tokens);
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        //=====================================================================

        /// <summary>
        /// This is used to get information from token, content layout, and site map files open in editors so
        /// that current information is displayed for them in the entity references control.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void ucEntityReferences_FileContentNeeded(object sender, FileContentNeededEventArgs e)
        {
            ContentLayoutWindow contentLayoutWindow;
            SiteMapEditorWindow siteMapEditorWindow;
            TokenEditorWindow   tokenEditorWindow;

            foreach (IDockContent content in this.DockPanel.Documents)
            {
                contentLayoutWindow = content as ContentLayoutWindow;

                if (contentLayoutWindow != null)
                {
                    e.ContentLayoutFiles.Add(contentLayoutWindow.Filename, contentLayoutWindow.Topics);
                }
                else
                {
                    siteMapEditorWindow = content as SiteMapEditorWindow;

                    if (siteMapEditorWindow != null)
                    {
                        e.SiteMapFiles.Add(siteMapEditorWindow.Filename, siteMapEditorWindow.Topics);
                    }
                    else
                    {
                        tokenEditorWindow = content as TokenEditorWindow;

                        if (tokenEditorWindow != null)
                        {
                            e.TokenFiles.Add(tokenEditorWindow.Filename, tokenEditorWindow.Tokens);
                        }
                    }
                }
            }
        }
Example #3
0
        //=====================================================================

        /// <summary>
        /// This is used to get information from token, content layout, and site map files open in editors
        /// so that current information is displayed for them in the entity references control.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void ucEntityReferences_FileContentNeeded(object sender, FileContentNeededEventArgs e)
        {
            IVsUIShell        uiShell = Utility.GetServiceFromPackage <IVsUIShell, SVsUIShell>(true);
            IEnumWindowFrames enumFrames;

            IVsWindowFrame[]        frames = new IVsWindowFrame[1];
            object                  docView;
            uint                    frameCount;
            ContentLayoutEditorPane contentLayoutPane;
            SiteMapEditorPane       siteMapPane;
            TokenEditorPane         tokenFilePane;

            if (uiShell.GetDocumentWindowEnum(out enumFrames) == VSConstants.S_OK)
            {
                while (enumFrames.Next(1, frames, out frameCount) == VSConstants.S_OK && frameCount == 1)
                {
                    if (frames[0].GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out docView) == VSConstants.S_OK)
                    {
                        contentLayoutPane = docView as ContentLayoutEditorPane;

                        if (contentLayoutPane != null)
                        {
                            e.ContentLayoutFiles.Add(contentLayoutPane.Filename, contentLayoutPane.Topics);
                        }
                        else
                        {
                            siteMapPane = docView as SiteMapEditorPane;

                            if (siteMapPane != null)
                            {
                                e.SiteMapFiles.Add(siteMapPane.Filename, siteMapPane.Topics);
                            }
                            else
                            {
                                tokenFilePane = docView as TokenEditorPane;

                                if (tokenFilePane != null)
                                {
                                    e.TokenFiles.Add(tokenFilePane.Filename, tokenFilePane.Tokens);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #4
0
        //=====================================================================

        /// <summary>
        /// This is used to get information from token and content layout files open in editors
        /// so that current information is displayed for them in the topic previewer control.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        /// <remarks>Site maps are ignored as they aren't supported by the topic previewer</remarks>
        private void ucTopicPreviewer_FileContentNeeded(object sender, FileContentNeededEventArgs e)
        {
            ContentLayoutWindow contentLayoutWindow;
            TokenEditorWindow   tokenEditorWindow;

            foreach (IDockContent content in this.DockPanel.Documents)
            {
                contentLayoutWindow = content as ContentLayoutWindow;

                if (contentLayoutWindow != null)
                {
                    e.ContentLayoutFiles.Add(contentLayoutWindow.Filename, contentLayoutWindow.Topics);
                }
                else
                {
                    tokenEditorWindow = content as TokenEditorWindow;

                    if (tokenEditorWindow != null)
                    {
                        e.TokenFiles.Add(tokenEditorWindow.Filename, tokenEditorWindow.Tokens);
                    }
                }
            }
        }