::NPTEAM:: Network Programer Team

검색 :
RSS 구독 : 글 / 댓글 / 트랙백 / 글+트랙백

[VS2005] 현재 편집 중인 문서 솔루션 익스플로러에서 찾기

2008/09/18 20:04, 글쓴이 TTF

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 20:04 2008/09/18 20:04

맨 위로