Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics

Public Module Misc

    Function GetOutputWindowPane(ByVal caption As String) As OutputWindowPane
        ' Description: Returns the OutputWindowPane with the given caption, or 
        '              creates and returns a new pane if one doesn't already exist

        Dim dte2 As EnvDTE80.DTE2 = CType(DTE, EnvDTE80.DTE2)
        Dim outputWin As OutputWindow = dte2.ToolWindows.OutputWindow
        Dim pane As OutputWindowPane

        Try
            pane = outputWin.OutputWindowPanes.Item(caption)
        Catch ex As System.Exception
            pane = outputWin.OutputWindowPanes.Add(caption)
        End Try

        Return pane
    End Function

End Module
