/// <summary> /// Initializes a new instance of the <see cref="VsEvents"/> class. /// </summary> /// <param name="environment"> /// The environment. /// </param> /// <param name="dte2"> /// The dte 2. /// </param> /// <param name="vsSonarExtensionPackage"></param> public VsEvents(IVsEnvironmentHelper environment, DTE2 dte2, VsSonarExtensionPackage vsSonarExtensionPackage) { this.dte2 = dte2; this.package = vsSonarExtensionPackage; this.environment = environment; this.SolutionEvents = dte2.Events; this.visualStudioEvents = dte2.Events.DTEEvents; this.buildEvents = dte2.Events.BuildEvents; this.DocumentsEvents = this.SolutionEvents.DocumentEvents; this.SolutionEvents.SolutionEvents.Opened += this.SolutionOpened; this.SolutionEvents.SolutionEvents.AfterClosing += this.SolutionClosed; this.SolutionEvents.WindowEvents.WindowActivated += this.WindowActivated; this.SolutionEvents.WindowEvents.WindowClosing += this.WindowClosed; this.DocumentsEvents.DocumentSaved += this.DoumentSaved; this.visualStudioEvents.OnStartupComplete += this.CloseToolWindows; this.buildEvents.OnBuildProjConfigDone += this.ProjectHasBuild; VSColorTheme.ThemeChanged += this.VSColorTheme_ThemeChanged; var extensionRunningPath = Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "").ToString(); var uniqueId = this.dte2.Version; if (extensionRunningPath.ToLower().Contains(this.dte2.Version + "exp")) { uniqueId += "Exp"; } SonarQubeViewModelFactory.StartupModelWithVsVersion(uniqueId, this.package).AnalysisModeHasChange += this.AnalysisModeHasChange; SonarQubeViewModelFactory.SQViewModel.VSonarQubeOptionsViewData.GeneralConfigurationViewModel.ConfigurationHasChanged += this.AnalysisModeHasChange; }
public void SetSite() { // Create the package var package = new VsSonarExtensionPackage() as IVsPackage; Assert.IsNotNull(package, "The object does not implement IVsPackage"); // Unsite the package Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK"); }
/// <summary> /// The vs color theme_ theme changed. /// </summary> /// <param name="e"> /// The e. /// </param> private void VSColorTheme_ThemeChanged(ThemeChangedEventArgs e) { Color defaultBackground = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey); Color defaultForeground = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowTextColorKey); SonarQubeViewModelFactory.SQViewModel.UpdateTheme( VsSonarExtensionPackage.ToMediaColor(defaultBackground), VsSonarExtensionPackage.ToMediaColor(defaultForeground)); }
public void IsIVsPackage() { var package = new VsSonarExtensionPackage(); Assert.IsNotNull(package, "The object does not implement IVsPackage"); }