コード例 #1
0
        //---------------------------------------------------------------------
        public void OpenSettingsWindow(ProjectSelectionKind kind)
        {
            var window = ConfigureSettingsWindows(kind, true);
            var frame  = (IVsWindowFrame)window.Frame;

            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(frame.Show());
        }
コード例 #2
0
        //---------------------------------------------------------------------
        StartUpProjectSettings ComputeOptionalSettings(
            SolutionConfiguration2 activeConfiguration,
            ProjectSelectionKind kind)
        {
            var             solution = (Solution2)dte.Solution;
            var             projects = GetProjects(solution);
            ExtendedProject project  = null;

            switch (kind)
            {
            case ProjectSelectionKind.StartUpProject:
                project = GetOptionalStartupProject(solution, projects);
                break;

            case ProjectSelectionKind.SelectedProject:
                project = GetOptionalSelectedProject(projects);
                break;
            }

            if (project == null)
            {
                return(null);
            }

            return(ComputeOptionalSettings(activeConfiguration, projects, project));
        }
コード例 #3
0
        //---------------------------------------------------------------------
        void RunCoverage(ProjectSelectionKind kind)
        {
            IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell));

            var errorHandler = new ErrorHandler(uiShell);

            errorHandler.Execute(() =>
            {
                var dte          = (DTE2)GetService(typeof(EnvDTE.DTE));
                var outputWindow = (IVsOutputWindow)GetService(typeof(SVsOutputWindow));
                var outputWriter = new OutputWindowWriter(dte, outputWindow);

                errorHandler.OutputWriter = outputWriter;
                var mainSettingsManager   = new MainSettingsManager(this, dte);
                var coverageViewManager   = GetCoverageViewManager();
                var coverageTreeManager   = new CoverageTreeManager(this, dte, coverageViewManager);
                var projectBuilder        = new ProjectBuilder(dte, errorHandler, outputWriter);
                var deserializer          = new CoverageDataDeserializer();
                var openCppCoverageRunner = new CoverageRunner(
                    dte, outputWriter, coverageTreeManager, projectBuilder,
                    coverageViewManager, deserializer, errorHandler);

                mainSettingsManager.ShowSettingsWindows(openCppCoverageRunner, kind);
            });
        }
コード例 #4
0
        //---------------------------------------------------------------------
        SettingToolWindow ConfigureSettingsWindows(
            ProjectSelectionKind kind,
            bool displayProgramOutput)
        {
            this.mainSettingController.UpdateFields(kind, displayProgramOutput);
            var window = this.windowFinder.FindToolWindow <SettingToolWindow>();

            window.Init(this.mainSettingController);

            return(window);
        }
コード例 #5
0
        //---------------------------------------------------------------------
        public void UpdateStartUpProject(ProjectSelectionKind kind)
        {
            var settings = this.StartUpProjectSettingsBuilder.ComputeSettings(kind);

            this.BasicSettingController.UpdateStartUpProject(settings);
            this.FilterSettingController.UpdateStartUpProject();
            this.ImportExportSettingController.UpdateStartUpProject();
            this.MiscellaneousSettingController.UpdateStartUpProject();

            SaveSettings();
        }
コード例 #6
0
        //---------------------------------------------------------------------
        public void UpdateStartUpProject(ProjectSelectionKind kind)
        {
            if (this.StartUpProjectSettingsBuilder == null)
            {
                throw new InvalidOperationException("StartUpProjectSettingsBuilder should be set.");
            }

            var settings = this.StartUpProjectSettingsBuilder.ComputeSettings(kind);

            this.BasicSettingController.UpdateStartUpProject(settings);
            this.FilterSettingController.UpdateStartUpProject();
            this.ImportExportSettingController.UpdateStartUpProject();
            this.MiscellaneousSettingController.UpdateStartUpProject();
        }
コード例 #7
0
        //---------------------------------------------------------------------
        public void UpdateSettings(ProjectSelectionKind kind)
        {
            if (this.StartUpProjectSettingsBuilder == null)
            {
                throw new InvalidOperationException("StartUpProjectSettingsBuilder should be set.");
            }

            if (File.Exists(settingsFile))
            {
                AllControllers allControllers = JsonConvert.DeserializeObject <AllControllers>(File.ReadAllText(settingsFile));
                if (allControllers.basicSettingController.CurrentProject.Equals(this.StartUpProjectSettingsBuilder.ComputeSettings(kind).ProjectName))
                {
                    RecoverSettings(allControllers);
                    return;
                }
            }

            UpdateStartUpProject(kind);
        }
コード例 #8
0
        //---------------------------------------------------------------------
        public void UpdateFields(ProjectSelectionKind kind, bool displayProgramOutput)
        {
            var settings = ComputeStartUpProjectSettings(kind);

            this.UpdateStartUpProject(settings);
            this.selectedProjectPath       = settings.ProjectPath;
            this.displayProgramOutput      = displayProgramOutput;
            this.solutionConfigurationName = settings.SolutionConfigurationName;
            this.kind = kind;

            var uiSettings = this.settingsStorage.TryLoad(this.selectedProjectPath, this.solutionConfigurationName);

            if (uiSettings != null)
            {
                this.BasicSettingController.UpdateSettings(uiSettings.BasicSettingController);
                this.FilterSettingController.UpdateSettings(uiSettings.FilterSettingController);
                this.ImportExportSettingController.UpdateSettings(uiSettings.ImportExportSettingController);
                this.MiscellaneousSettingController.UpdateSettings(uiSettings.MiscellaneousSettingController);
            }
        }
コード例 #9
0
        //---------------------------------------------------------------------
        public StartUpProjectSettings ComputeSettings(ProjectSelectionKind kind)
        {
            var solution            = (Solution2)dte.Solution;
            var solutionBuild       = (SolutionBuild2)solution.SolutionBuild;
            var activeConfiguration = (SolutionConfiguration2)solutionBuild.ActiveConfiguration;

            if (activeConfiguration != null)
            {
                var settings = ComputeOptionalSettings(activeConfiguration, kind);

                if (settings != null)
                {
                    return(settings);
                }
            }

            return(new StartUpProjectSettings
            {
                CppProjects = new List <StartUpProjectSettings.CppProject>()
            });
        }
コード例 #10
0
        //---------------------------------------------------------------------
        public void ShowSettingsWindows(
            CoverageRunner coverageRunner,
            ProjectSelectionKind kind)
        {
            var configurationManager = new ConfigurationManager();
            var settingsBuilder      = new StartUpProjectSettingsBuilder(this.dte, configurationManager);

            var window = this.package.FindToolWindow(
                typeof(SettingToolWindow), 0, true) as SettingToolWindow;

            if (window == null || window.Frame == null)
            {
                throw new NotSupportedException("Cannot create tool window");
            }

            window.Controller.StartUpProjectSettingsBuilder = settingsBuilder;
            window.Controller.CoverageRunner = coverageRunner;
            window.Controller.UpdateStartUpProject(kind);
            var frame = (IVsWindowFrame)window.Frame;

            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(frame.Show());
        }
コード例 #11
0
 //---------------------------------------------------------------------
 StartUpProjectSettings ComputeStartUpProjectSettings(ProjectSelectionKind kind)
 {
     return(this.startUpProjectSettingsBuilder.ComputeSettings(kind));
 }
コード例 #12
0
 //---------------------------------------------------------------------
 public void RunCoverage(ProjectSelectionKind kind)
 {
     this.RunCommand(mainWindowsManager =>
                     mainWindowsManager.RunCoverage(kind)
                     );
 }
コード例 #13
0
 //---------------------------------------------------------------------
 public void OpenSettingsWindow(ProjectSelectionKind kind)
 {
     this.RunCommand(mainWindowsManager =>
                     mainWindowsManager.OpenSettingsWindow(kind)
                     );
 }
コード例 #14
0
        //---------------------------------------------------------------------
        public void RunCoverage(ProjectSelectionKind kind)
        {
            var window = ConfigureSettingsWindows(kind, false);

            window.Controller.RunCoverageCommand.Execute(null);
        }