public ActiveSolutionBoundTracker(IHost host, IActiveSolutionTracker activeSolutionTracker) { if (host == null) { throw new ArgumentNullException(nameof(host)); } if (activeSolutionTracker == null) { throw new ArgumentNullException(nameof(activeSolutionTracker)); } this.extensionHost = host; this.solutionTracker = activeSolutionTracker; this.solutionBindingInformationProvider = this.extensionHost.GetService<ISolutionBindingInformationProvider>(); this.solutionBindingInformationProvider.AssertLocalServiceIsNotNull(); this.errorListInfoBarController = this.extensionHost.GetService<IErrorListInfoBarController>(); this.errorListInfoBarController.AssertLocalServiceIsNotNull(); this.errorListInfoBarController.Refresh(); // The user changed the binding through the Team Explorer this.extensionHost.VisualStateManager.BindingStateChanged += this.OnBindingStateChanged; // The solution changed inside the IDE this.solutionTracker.ActiveSolutionChanged += this.OnActiveSolutionChanged; this.IsActiveSolutionBound = this.solutionBindingInformationProvider.IsSolutionBound(); }
public ErrorListInfoBarController(IHost host) { if (host == null) { throw new ArgumentNullException(nameof(host)); } this.host = host; this.bindingInformationProvider = host.GetService<ISolutionBindingInformationProvider>(); this.bindingInformationProvider.AssertLocalServiceIsNotNull(); }
public ErrorListInfoBarController(IHost host, ISolutionBindingInformationProvider bindingInformationProvider) { if (host == null) { throw new ArgumentNullException(nameof(host)); } if (bindingInformationProvider == null) { throw new ArgumentNullException(nameof(bindingInformationProvider)); } this.host = host; this.bindingInformationProvider = bindingInformationProvider; this.configProvider = host.GetService <IConfigurationProvider>(); this.configProvider.AssertLocalServiceIsNotNull(); }
public BindingWorkflow(IHost host, BindCommandArgs bindingArgs, ISolutionBindingOperation solutionBindingOperation, INuGetBindingOperation nugetBindingOperation, ISolutionBindingInformationProvider bindingInformationProvider, bool isFirstBinding = false) { if (host == null) { throw new ArgumentNullException(nameof(host)); } if (bindingArgs == null) { throw new ArgumentNullException(nameof(bindingArgs)); } Debug.Assert(bindingArgs.ProjectKey != null); Debug.Assert(bindingArgs.ProjectName != null); Debug.Assert(bindingArgs.Connection != null); if (solutionBindingOperation == null) { throw new ArgumentNullException(nameof(solutionBindingOperation)); } if (nugetBindingOperation == null) { throw new ArgumentNullException(nameof(nugetBindingOperation)); } if (bindingInformationProvider == null) { throw new ArgumentNullException(nameof(bindingInformationProvider)); } this.host = host; this.bindingArgs = bindingArgs; this.projectSystem = this.host.GetService <IProjectSystemHelper>(); this.projectSystem.AssertLocalServiceIsNotNull(); this.solutionBindingOperation = solutionBindingOperation; this.NuGetBindingOperation = nugetBindingOperation; this.bindingInformationProvider = bindingInformationProvider; this.IsFirstBinding = isFirstBinding; }
public ActiveSolutionBoundTracker(IHost host, IActiveSolutionTracker activeSolutionTracker, ISonarLintOutput sonarLintOutput) { if (host == null) { throw new ArgumentNullException(nameof(host)); } if (activeSolutionTracker == null) { throw new ArgumentNullException(nameof(activeSolutionTracker)); } if (sonarLintOutput == null) { throw new ArgumentNullException(nameof(sonarLintOutput)); } this.extensionHost = host; this.solutionTracker = activeSolutionTracker; this.sonarLintOutput = sonarLintOutput; this.solutionBindingInformationProvider = this.extensionHost.GetService <ISolutionBindingInformationProvider>(); this.solutionBindingInformationProvider.AssertLocalServiceIsNotNull(); this.errorListInfoBarController = this.extensionHost.GetService <IErrorListInfoBarController>(); this.errorListInfoBarController.AssertLocalServiceIsNotNull(); //TODO: check whether the errorListInfobarController needs to be refreshed // The user changed the binding through the Team Explorer this.extensionHost.VisualStateManager.BindingStateChanged += this.OnBindingStateChanged; // The solution changed inside the IDE this.solutionTracker.ActiveSolutionChanged += this.OnActiveSolutionChanged; this.IsActiveSolutionBound = this.solutionBindingInformationProvider.IsSolutionBound(); this.ProjectKey = this.solutionBindingInformationProvider.GetProjectKey(); }
internal /* for testing purposes */ static Project[] GetProjectsForRulesetBinding(bool isFirstBinding, Project[] allSupportedProjects, ISolutionBindingInformationProvider bindingInformationProvider, ILogger logger) { // If we are already bound we don't need to update/create rulesets in projects // that already have the ruleset information configured var projectsToUpdate = allSupportedProjects; if (isFirstBinding) { logger.WriteLine(Strings.Bind_Ruleset_InitialBinding); } else { var unboundProjects = bindingInformationProvider.GetUnboundProjects()?.ToArray() ?? new Project[] { }; projectsToUpdate = projectsToUpdate.Intersect(unboundProjects).ToArray(); var upToDateProjects = allSupportedProjects.Except(unboundProjects); if (upToDateProjects.Any()) { logger.WriteLine(Strings.Bind_Ruleset_SomeProjectsDoNotNeedToBeUpdated); var projectList = string.Join(", ", upToDateProjects.Select(p => p.Name)); logger.WriteLine($" {projectList}"); } else { logger.WriteLine(Strings.Bind_Ruleset_AllProjectsNeedToBeUpdated); } } return(projectsToUpdate); }