Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Public Module SolutionExplorer
Sub FindInSolution()
Dim p = DTE.Properties("Environment", "ProjectsAndSolution").Item("TrackFileSelectionInExplorer")
p.value = 1
p.value = 0
End Sub
Sub CollapseNode(ByRef item As UIHierarchyItem)
Dim subitem As UIHierarchyItem
For Each subitem In item.UIHierarchyItems
If (subitem.UIHierarchyItems.Expanded = True) Then
CollapseNode(subitem)
subitem.UIHierarchyItems.Expanded = False
End If
Next
End Sub
Sub CollapseAll()
' Get the the Solution Explorer tree
Dim UIHSolutionExplorer As UIHierarchy
UIHSolutionExplorer = DTE.Windows.Item(EnvDTE.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)
CollapseNode(UIHSolutionRootNode)
' 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)
End Sub
End Module





2008/09/18
SolutionExplorer.vb








블로그 이전 ..












