public static IVsOutputWindowPane GetOrCreateSonarLintOutputPane(IServiceProvider serviceProvider)
{
IVsOutputWindow outputWindow = serviceProvider.GetService<SVsOutputWindow, IVsOutputWindow>();
if (outputWindow == null)
{
Debug.Fail("Could not get IVsOutputWindow");
return null;
}
const bool makeVisible = true;
const bool clearWithSolution = true;
IVsOutputWindowPane pane;
int hrCreatePane = outputWindow.CreatePane(
ref SonarLintOutputPaneGuid,
Strings.SonarLintOutputPaneTitle,
Convert.ToInt32(makeVisible),
Convert.ToInt32(clearWithSolution));
Debug.Assert(ErrorHandler.Succeeded(hrCreatePane), "Failed in outputWindow.CreatePane: " + hrCreatePane.ToString());
int hrGetPane = outputWindow.GetPane(ref SonarLintOutputPaneGuid, out pane);
Debug.Assert(ErrorHandler.Succeeded(hrGetPane), "Failed in outputWindow.GetPane: " + hrGetPane.ToString());
return pane;
}