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---------------------------------------------------- 

  • 相关阅读:
    Java的值传递和引用传递的说法
    将对象写道硬盘上and从硬盘上读入对象
    分割一个文件and合并一个文件(并且带有配置信息记录)
    文件的切割和合并
    SequenceInputStream的用法(用来合并流然后一起操作)
    PrintStream和PrintWrite用法
    将一个文件夹中的所有含有某个后缀的文件写进一个文件里面
    关于Properties的制作配置文件(当一个app已经5次被打开我们就收费)
    Properties的用法
    深层删除一个目录(java)
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1736946.html
Copyright © 2011-2022 走看看