/// <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
        public DeprecationManager(IInfoBarManager infoBarManager, ISonarLintOutput sonarLintOutput)
        {
            if (infoBarManager == null)
            {
                throw new ArgumentNullException(nameof(infoBarManager));
            }
            if (sonarLintOutput == null)
            {
                throw new ArgumentNullException(nameof(sonarLintOutput));
            }

            this.infoBarManager  = infoBarManager;
            this.sonarLintOutput = sonarLintOutput;
        }
Esempio n. 3
0
        public DeprecationManager(IInfoBarManager infoBarManager, ILogger sonarLintOutput)
        {
            if (infoBarManager == null)
            {
                throw new ArgumentNullException(nameof(infoBarManager));
            }
            if (sonarLintOutput == null)
            {
                throw new ArgumentNullException(nameof(sonarLintOutput));
            }

            this.infoBarManager  = infoBarManager;
            this.sonarLintOutput = sonarLintOutput;

            if (VisualStudioHelpers.IsVisualStudioBeforeUpdate3())
            {
                WriteMessageToOutput();
                ShowDeprecationBar();
            }
        }
Esempio n. 4
0
        private void ClearCurrentInfoBar()
        {
            this.CancelQualityProfileProcessing();

            this.infoBarBinding = null;
            this.currentErrorWindowInfoBarHandlingClick = false;
            if (this.currentErrorWindowInfoBar == null)
            {
                return;
            }

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

            IInfoBarManager manager = this.host.GetMefService <IInfoBarManager>();

            if (manager == null) // Could be null during shut down
            {
                return;
            }

            manager.DetachInfoBar(this.currentErrorWindowInfoBar);
            this.currentErrorWindowInfoBar = null;
        }
Esempio n. 5
0
 public OpenInIDEFailureInfoBar(IInfoBarManager infoBarManager,
                                IOutputWindowService outputWindowService)
 {
     this.infoBarManager      = infoBarManager;
     this.outputWindowService = outputWindowService;
 }