Beispiel #1
0
        protected override void Initialize()
        {
            base.Initialize();
            this.InitializeSqm();

            IServiceProvider serviceProvider = this;

            var activeSolutionBoundTracker = this.GetMefService <IActiveSolutionBoundTracker>();
            var sonarQubeService           = this.GetMefService <ISonarQubeService>();
            var workspace = this.GetMefService <VisualStudioWorkspace>();

            logger = this.GetMefService <ILogger>();
            Debug.Assert(logger != null, "MEF composition error - failed to retrieve a logger");

            var vsSolution = serviceProvider.GetService <SVsSolution, IVsSolution>();

            this.sonarAnalyzerManager = new SonarAnalyzerManager(activeSolutionBoundTracker, sonarQubeService, workspace,
                                                                 vsSolution, logger);

            this.usageAnalyzer = new BoundSolutionAnalyzer(serviceProvider);

            this.commandManager = new PackageCommandManager(serviceProvider.GetService <IMenuCommandService>());
            this.commandManager.Initialize(serviceProvider.GetMefService <ITeamExplorerController>(),
                                           serviceProvider.GetMefService <IProjectPropertyManager>());

            this.deprecationManager = new DeprecationManager(this.GetMefService <IInfoBarManager>(), logger);
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (disposing)
            {
                this.sonarAnalyzerManager?.Dispose();
                this.sonarAnalyzerManager = null;

                this.deprecationManager?.Dispose();
                this.deprecationManager = null;
            }
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (disposing)
            {
                this.usageAnalyzer?.Dispose();
                this.usageAnalyzer = null;

                this.sonarAnalyzerManager?.Dispose();
                this.sonarAnalyzerManager = null;
            }
        }
Beispiel #4
0
        protected override void Initialize()
        {
            base.Initialize();
            this.InitializeSqm();

            IServiceProvider serviceProvider = this;

            this.sonarAnalyzerManager = new SonarAnalyzerManager(serviceProvider);
            this.usageAnalyzer        = new BoundSolutionAnalyzer(serviceProvider);
            this.commandManager       = new PackageCommandManager(serviceProvider);

            this.commandManager.Initialize();
        }
        protected override void Initialize()
        {
            base.Initialize();
            this.InitializeSqm();

            IServiceProvider serviceProvider = this;

            this.sonarAnalyzerManager = new SonarAnalyzerManager(serviceProvider);
            this.usageAnalyzer = new BoundSolutionAnalyzer(serviceProvider);
            this.commandManager = new PackageCommandManager(serviceProvider);

            this.commandManager.Initialize();
        }
        public void TestInitialize()
        {
            this.serviceProvider = new ConfigurableServiceProvider(false);

            this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher);
            this.activeSolutionBoundTracker = new ConfigurableActiveSolutionBoundTracker();
            var outputWindow = new ConfigurableVsOutputWindow();

            var mefExport1 = MefTestHelpers.CreateExport<IHost>(this.host);
            var mefExport2 = MefTestHelpers.CreateExport<IActiveSolutionBoundTracker>(this.activeSolutionBoundTracker);
            var mefModel = ConfigurableComponentModel.CreateWithExports(mefExport1, mefExport2);

            this.serviceProvider.RegisterService(typeof(SComponentModel), mefModel);
            this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow);

            this.testSubject = new SonarAnalyzerManager(this.serviceProvider, new AdhocWorkspace());
        }
        protected override void Initialize()
        {
            base.Initialize();
            this.InitializeSqm();

            IServiceProvider serviceProvider = this;

            this.sonarAnalyzerManager = new SonarAnalyzerManager(serviceProvider);
            this.suppressionManager   = new SuppressionManager(serviceProvider);
            this.usageAnalyzer        = new BoundSolutionAnalyzer(serviceProvider);

            this.commandManager = new PackageCommandManager(serviceProvider);
            this.commandManager.Initialize();

            this.deprecationManager = new DeprecationManager(this.GetMefService <IInfoBarManager>(),
                                                             this.GetMefService <ISonarLintOutput>());
            this.deprecationManager.Initialize(VisualStudioHelpers.VisualStudioVersion);
        }
        private async System.Threading.Tasks.Task InitOnUIThreadAsync()
        {
            Debug.Assert(ThreadHelper.CheckAccess(), "SonarLint package - expecteding to be called in the UI thread");

            try
            {
                logger = await this.GetMefServiceAsync <ILogger>();

                Debug.Assert(logger != null, "MEF composition error - failed to retrieve a logger");
                logger.WriteLine(Resources.Strings.SL_Initializing);

                this.InitializeSqm();

                IServiceProvider serviceProvider = this;

                var activeSolutionBoundTracker = await this.GetMefServiceAsync <IActiveSolutionBoundTracker>();

                var sonarQubeService = await this.GetMefServiceAsync <ISonarQubeService>();

                var workspace = await this.GetMefServiceAsync <VisualStudioWorkspace>();


                var vsSolution = serviceProvider.GetService <SVsSolution, IVsSolution>();
                this.sonarAnalyzerManager = new SonarAnalyzerManager(activeSolutionBoundTracker, sonarQubeService, workspace,
                                                                     vsSolution, logger);

                this.usageAnalyzer = new BoundSolutionAnalyzer(serviceProvider);

                this.commandManager = new PackageCommandManager(serviceProvider.GetService <IMenuCommandService>());
                this.commandManager.Initialize(serviceProvider.GetMefService <ITeamExplorerController>(),
                                               serviceProvider.GetMefService <IProjectPropertyManager>());

                this.deprecationManager = new DeprecationManager(this.GetMefService <IInfoBarManager>(), logger);

                logger.WriteLine(Resources.Strings.SL_InitializationComplete);
            }
            catch (Exception ex) when(!ErrorHandler.IsCriticalException(ex))
            {
                // Suppress non-critical exceptions
                logger.WriteLine(Resources.Strings.SL_ERROR, ex.Message);
            }
        }