/// <summary>
        /// Refreshes the solution explorer tree
        /// </summary>
        /// <param name="nodes">A list of nodes which were originally selected</param>
        /// <remarks>
        /// Refreshing the tree cancels the selection, the nodes list is used to restore the
        /// selection. The items on the list could have been changed/ recreated as a side
        /// effect of the operation, so the list of the nodes is re-mapped
        /// </remarks>
        public void RefreshSolutionExplorer(IEnumerable <ItemNode> nodes)
        {
            projectProxy.RefreshSolutionExplorer();

            bool first = true;

            foreach (var node in itemList.RemapNodes(nodes))
            {
                if (first)
                {
                    GlobalServices.solutionExplorer.ExpandItem(this, node.ItemId, EXPANDFLAGS.EXPF_SelectItem);
                    first = false;
                }
                else
                {
                    GlobalServices.solutionExplorer.ExpandItem(this, node.ItemId, EXPANDFLAGS.EXPF_AddSelectItem);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Refreshes the solution explorer tree
        /// </summary>
        /// <param name="nodes">A list of nodes which were originally selected</param>
        /// <remarks>
        /// Refreshing the tree cancels the selection, the nodes list is used to restore the
        /// selection. The items on the list could have been changed/ recreated as a side
        /// effect of the operation, so the list of the nodes is re-mapped
        /// </remarks>
        public void RefreshSolutionExplorer(IEnumerable <ItemNode> nodes)
        {
            projectProxy.RefreshSolutionExplorer();

            bool first = true;
            IVsUIHierarchyWindow explorer = GlobalServices.SolutionExplorer;

            if (explorer != null)
            {
                foreach (var node in itemList.RemapNodes(nodes))
                {
                    if (first)
                    {
                        explorer.ExpandItem(this, node.ItemId, EXPANDFLAGS.EXPF_SelectItem);
                        first = false;
                    }
                    else
                    {
                        explorer.ExpandItem(this, node.ItemId, EXPANDFLAGS.EXPF_AddSelectItem);
                    }
                }
            }
        }