zoukankan      html  css  js  c++  java
  • [VS Macro]CollaposeAll Projects in Solution

    From Here

    As Title .

    ---------------------------------Copy Start----------------------------------------------------

    Imports System
    Imports EnvDTE
    Imports System.Diagnostics

    Public Module CollapseAll
        Sub CollapseAll()
            ' Get the the Solution Explorer tree
            Dim UIHSolutionExplorer As UIHierarchy
            UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
            ' Check if there is any open solution
            If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then
                ' MsgBox("Nothing to collapse. You must have an open solution.")
                Return
            End If
            ' Get the top node (the name of the solution)
            Dim UIHSolutionRootNode As UIHierarchyItem
            UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)
            UIHSolutionExplorer = Nothing
            UIHSolutionRootNode.DTE.SuppressUI = True
            ' Collapse each project node
            Dim UIHItem As UIHierarchyItem
            For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
                'UIHItem.UIHierarchyItems.Expanded = False
                If UIHItem.UIHierarchyItems.Expanded Then
                    Collapse(UIHItem)
                End If
            Next
            ' Select the solution node, or else when you click
            ' on the solution window
            ' scrollbar, it will synchronize the open document
            ' with the tree and pop
            ' out the corresponding node which is probably not what you want.
            UIHSolutionRootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
            UIHSolutionRootNode.DTE.SuppressUI = False
            UIHSolutionRootNode = Nothing
        End Sub

        Private Sub Collapse(ByVal item As UIHierarchyItem)
            For Each eitem As UIHierarchyItem In item.UIHierarchyItems
                If eitem.UIHierarchyItems.Expanded AndAlso eitem.UIHierarchyItems.Count > 0 Then
                    Collapse(eitem)
                End If
            Next
            item.UIHierarchyItems.Expanded = False
        End Sub
    End Module 

    ---------------------------------Copy End---------------------------------------------------- 

  • 相关阅读:
    总结mysql服务器查询慢原因与解决方法
    mysql查询今天,昨天,近7天,近30天,本月,上一月数据的方法
    Github 终于开始认真考虑开源项目许可证了
    mysql 外连接总结
    MYSQL--事务处理
    MySQL 索引详解
    MySQL数据库优化总结
    Delphi 2010 安装及调试
    Delphi 2010
    PostgreSQL 8.4.1
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1736946.html
Copyright © 2011-2022 走看看