当前位置: 首页>>代码示例>>C#>>正文


C# ITextBuffer.GetSourceBuffersRecursive方法代码示例

本文整理汇总了C#中ITextBuffer.GetSourceBuffersRecursive方法的典型用法代码示例。如果您正苦于以下问题:C# ITextBuffer.GetSourceBuffersRecursive方法的具体用法?C# ITextBuffer.GetSourceBuffersRecursive怎么用?C# ITextBuffer.GetSourceBuffersRecursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITextBuffer的用法示例。


在下文中一共展示了ITextBuffer.GetSourceBuffersRecursive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Save

        internal Result Save(ITextBuffer textBuffer)
        {
            // In order to save the ITextBuffer we need to get a document cookie for it.  The only way I'm
            // aware of is to use the path moniker which is available for the accompanying ITextDocment 
            // value.  
            //
            // In many types of files (.cs, .vb, .cpp) there is usually a 1-1 mapping between ITextBuffer 
            // and the ITextDocument.  But in any file type where an IProjectionBuffer is common (.js, 
            // .aspx, etc ...) this mapping breaks down.  To get it back we must visit all of the 
            // source buffers for a projection and individually save them
            var result = Result.Success;
            foreach (var sourceBuffer in textBuffer.GetSourceBuffersRecursive())
            {
                // The inert buffer doesn't need to be saved.  It's used as a fake buffer by web applications
                // in order to render projected content
                if (sourceBuffer.ContentType == _textBufferFactoryService.InertContentType)
                {
                    continue;
                }

                var sourceResult = SaveCore(sourceBuffer);
                if (sourceResult.IsError)
                {
                    result = sourceResult;
                }
            }

            return result;
        }
开发者ID:aesire,项目名称:VsVim,代码行数:29,代码来源:TextManager.cs

示例2: IsDirty

        public virtual bool IsDirty(ITextBuffer textBuffer)
        {
            // If this is an IProjectionBuffer then we need to dig into the actual ITextBuffer values
            // which make it up.
            foreach (var sourceTextBuffer in textBuffer.GetSourceBuffersRecursive())
            {
                // The inert buffer doesn't need to be considered.  It's used as a fake buffer by web applications
                // in order to render projected content
                if (sourceTextBuffer.ContentType == _textBufferFactoryService.InertContentType)
                {
                    continue;
                }

                ITextDocument document;
                if (_textDocumentFactoryService.TryGetTextDocument(sourceTextBuffer, out document) && document.IsDirty)
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:honeyhoneywell,项目名称:VsVim,代码行数:22,代码来源:VimHost.cs


注:本文中的ITextBuffer.GetSourceBuffersRecursive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。