/// <summary>
        /// Update
        /// </summary>
        /// <param name="customInfoBarMessage">Optional. If provided than this will be the message that will appear in info bar, otherwise a standard one will appear instead</param>
        private void UpdateRequired(string customInfoBarMessage = null)
        {
            this.AssertOnUIThread();
            IInfoBarManager manager = this.host.GetMefService <IInfoBarManager>();

            if (manager == null)
            {
                Debug.Fail("Cannot find IInfoBarManager");
                return;
            }

            this.currentErrorWindowInfoBar = manager.AttachInfoBarWithButton(
                ErrorListToolWindowGuid,
                customInfoBarMessage ?? Strings.SonarLintInfoBarUnboundProjectsMessage,
                Strings.SonarLintInfoBarUpdateCommandText,
                KnownMonikers.RuleWarning);

            if (this.currentErrorWindowInfoBar == null)
            {
                this.OutputMessage(Strings.SonarLintFailedToAttachInfoBarToErrorList);
                Debug.Fail("Failed to add an info bar to the error list tool window");
            }
            else
            {
                var componentModel = host.GetService <SComponentModel, IComponentModel>();
                TelemetryLoggerAccessor.GetLogger(componentModel)?.ReportEvent(TelemetryEvent.ErrorListInfoBarShow);

                this.currentErrorWindowInfoBar.Closed      += this.CurrentErrorWindowInfoBar_Closed;
                this.currentErrorWindowInfoBar.ButtonClick += this.CurrentErrorWindowInfoBar_ButtonClick;

                // Need to capture the current binding information since the user can change the binding
                // and running the Update should just no-op in that case.
                this.infoBarBinding = configProvider.GetConfiguration().Project;
            }
        }
Esempio n. 2
0
        private void AddInfoBar(Guid toolWindowId)
        {
            currentInfoBar = infoBarManager.AttachInfoBarWithButton(toolWindowId, OpenInIDEResources.RequestValidator_InfoBarMessage, "Show Output Window", default);
            Debug.Assert(currentInfoBar != null, "currentInfoBar != null");

            currentInfoBar.ButtonClick += ShowOutputWindow;
            currentInfoBar.Closed      += CurrentInfoBar_Closed;
        }