internal /* for testing */ void Execute(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); try { toolWindowService.Show(toolWindowId); } catch (Exception ex) when(!ErrorHandler.IsCriticalException(ex)) { logger.WriteLine(string.Format(Resources.ERR_ShowToolWindow_Exception, toolWindowId, ex)); } }
private async Task ShowHotspotAsync(IShowHotspotRequest request) { logger.WriteLine(OpenInIDEResources.ApiHandler_ProcessingRequest, request.ServerUrl, request.ProjectKey, request.OrganizationKey ?? OpenInIDEResources.ApiHandler_NullOrganization, request.HotspotKey); // Always show the Hotspots tool window. If we can't successfully process the // request we'll show a gold bar in the window telemetryManager.ShowHotspotRequested(); ideWindowService.BringToFront(); toolWindowService.Show(HotspotsToolWindow.ToolWindowId); await failureInfoBar.ClearAsync(); if (!ideStateValidator.CanHandleOpenInIDERequest(request.ServerUrl, request.ProjectKey, request.OrganizationKey)) { // We're assuming the validator will have output an explanantion of why the IDE // isn't in the correct state await failureInfoBar.ShowAsync(HotspotsToolWindow.ToolWindowId); return; } var hotspot = await TryGetHotspotData(request.HotspotKey); if (hotspot == null) { await failureInfoBar.ShowAsync(HotspotsToolWindow.ToolWindowId); return; } var hotspotViz = TryCreateIssueViz(hotspot); if (hotspotViz == null) { await failureInfoBar.ShowAsync(HotspotsToolWindow.ToolWindowId); return; } if (!navigator.TryNavigate(hotspotViz)) { logger.WriteLine(OpenInIDEResources.ApiHandler_FailedToNavigateToHotspot, hotspotViz.FilePath, hotspotViz.StartLine); } // Add to store and select regardless of whether navigation succeeded var addedHotspot = hotspotsStore.GetOrAdd(hotspotViz); issueSelectionService.SelectedIssue = addedHotspot; }
public void Show() { var sonarLintOutputPane = VsShellUtils.GetOrCreateSonarLintOutputPane(serviceProvider); Debug.Assert(sonarLintOutputPane != null, "Failed to create SonarLint pane"); if (sonarLintOutputPane == null) { return; } var hr = sonarLintOutputPane.Activate(); Debug.Assert(ErrorHandler.Succeeded(hr), "Failed to activate SonarLint pane: " + hr); if (ErrorHandler.Succeeded(hr)) { toolWindowService.Show(VSConstants.StandardToolWindows.Output); } }