コード例 #1
0
ファイル: OutliningHelper.cs プロジェクト: emonney/CodeNav
        /// <summary>
        /// Set all #region collapsibles in a document
        /// </summary>
        /// <param name="document">document that holds the regions</param>
        /// <param name="isExpanded">should region be expanded</param>
        public static void SetAllRegions(IEnumerable <CodeItem> document, bool isExpanded)
        {
            var regions = new List <CodeItem>();

            FindHelper.Find(regions, document, CodeItemKindEnum.Region);
            foreach (var region in regions.Distinct())
            {
                var collapsible = FindCollapsibleFromCodeItem(region, _manager, _textView);
                SetRegionIsExpanded(document, collapsible, isExpanded);
            }
        }
コード例 #2
0
ファイル: OutliningHelper.cs プロジェクト: emonney/CodeNav
        private static void SetRegionIsExpanded(IEnumerable <CodeItem> document, ICollapsible region, bool isExpanded)
        {
            var startLine = GetStartLineForCollapsible(region);

            var found = new List <CodeItem>();

            FindHelper.Find(found, document, startLine);
            if (!found.Any())
            {
                return;
            }

            var item = found.Last();

            if (!(item is IMembers))
            {
                return;
            }
            (item as IMembers).IsExpanded = isExpanded;
        }