Esempio n. 1
0
        private static TaintIssuesControlViewModel CreateTestSubject(
            IAnalysisIssueVisualization[] issueVizs = null,
            ILocationNavigator locationNavigator    = null,
            Mock <ITaintStore> store = null,
            IActiveDocumentTracker activeDocumentTracker = null,
            IActiveDocumentLocator activeDocumentLocator = null,
            ITelemetryManager telemetryManager           = null,
            IShowInBrowserService showInBrowserService   = null,
            IIssueSelectionService selectionService      = null)
        {
            issueVizs ??= Array.Empty <IAnalysisIssueVisualization>();
            store ??= new Mock <ITaintStore>();
            store.Setup(x => x.GetAll()).Returns(issueVizs);

            activeDocumentTracker ??= Mock.Of <IActiveDocumentTracker>();
            activeDocumentLocator ??= Mock.Of <IActiveDocumentLocator>();
            showInBrowserService ??= Mock.Of <IShowInBrowserService>();
            locationNavigator ??= Mock.Of <ILocationNavigator>();
            telemetryManager ??= Mock.Of <ITelemetryManager>();
            selectionService ??= Mock.Of <IIssueSelectionService>();

            return(new TaintIssuesControlViewModel(store.Object,
                                                   locationNavigator,
                                                   activeDocumentTracker,
                                                   activeDocumentLocator,
                                                   showInBrowserService,
                                                   telemetryManager,
                                                   selectionService));
        }
        public SelectedVisualizationValidityMonitor(IIssueSelectionService selectionService, IIssueLocationStoreAggregator locationStoreAggregator)
        {
            this.selectionService        = selectionService;
            this.locationStoreAggregator = locationStoreAggregator;

            locationStoreAggregator.IssuesChanged += LocationStoreAggregator_IssuesChanged;
        }
Esempio n. 3
0
        private static IssueLocationActionsSource CreateTestSubject(ITagAggregator <ISelectedIssueLocationTag> selectedIssueLocationsTagAggregator,
                                                                    ITagAggregator <IIssueLocationTag> issueLocationsTagAggregator,
                                                                    IIssueSelectionService selectionService = null,
                                                                    ILightBulbBroker lightBulbBroker        = null,
                                                                    ITextView textView = null)
        {
            textView = textView ?? CreateWpfTextView();
            var vsUiShell = Mock.Of <IVsUIShell>();
            var bufferTagAggregatorFactoryService = new Mock <IBufferTagAggregatorFactoryService>();

            bufferTagAggregatorFactoryService
            .Setup(x => x.CreateTagAggregator <ISelectedIssueLocationTag>(textView.TextBuffer))
            .Returns(selectedIssueLocationsTagAggregator);

            bufferTagAggregatorFactoryService
            .Setup(x => x.CreateTagAggregator <IIssueLocationTag>(textView.TextBuffer))
            .Returns(issueLocationsTagAggregator);

            var analysisIssueSelectionServiceMock = new Mock <IIssueSelectionService>();

            analysisIssueSelectionServiceMock.Setup(x => x.SelectedIssue).Returns(Mock.Of <IAnalysisIssueVisualization>());

            selectionService ??= analysisIssueSelectionServiceMock.Object;
            lightBulbBroker ??= Mock.Of <ILightBulbBroker>();

            return(new IssueLocationActionsSource(lightBulbBroker, vsUiShell, bufferTagAggregatorFactoryService.Object, textView, selectionService));
        }
 public OpenInIDERequestHandler(
     IIDEWindowService ideWindowService,
     IToolWindowService toolWindowService,
     IOpenInIDEStateValidator ideStateValidator,
     ISonarQubeService sonarQubeService,
     IHotspotToIssueVisualizationConverter converter,
     ILocationNavigator navigator,
     IHotspotsStore hotspotsStore,
     IOpenInIDEFailureInfoBar failureInfoBar,
     IIssueSelectionService issueSelectionService,
     ITelemetryManager telemetryManager,
     ILogger logger)
 {
     // MEF-created so the arguments should never be null
     this.ideWindowService      = ideWindowService;
     this.toolWindowService     = toolWindowService;
     this.ideStateValidator     = ideStateValidator;
     this.sonarQubeService      = sonarQubeService;
     this.converter             = converter;
     this.navigator             = navigator;
     this.hotspotsStore         = hotspotsStore;
     this.failureInfoBar        = failureInfoBar;
     this.issueSelectionService = issueSelectionService;
     this.telemetryManager      = telemetryManager;
     this.logger = logger;
 }
Esempio n. 5
0
 public AnalysisIssueSelectionService(
     [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
     IIssueSelectionService selectionService)
 {
     monitorSelection      = serviceProvider.GetService(typeof(SVsShellMonitorSelection)) as IVsMonitorSelection;
     this.selectionService = selectionService;
     this.selectionService.SelectedIssueChanged += SelectionService_SelectedIssueChanged;
 }
Esempio n. 6
0
 public IssueLocationActionsSourceProvider([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
                                           IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService,
                                           IIssueSelectionService selectionService,
                                           ILightBulbBroker lightBulbBroker)
 {
     this.bufferTagAggregatorFactoryService = bufferTagAggregatorFactoryService;
     this.selectionService = selectionService;
     this.lightBulbBroker  = lightBulbBroker;
     vsUiShell             = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
 }
        private static SonarErrorListDataSource CreateTestSubject(IIssueSelectionService selectionService = null)
        {
            var managerMock  = new Mock <ITableManager>();
            var providerMock = new Mock <ITableManagerProvider>();

            providerMock.Setup(x => x.GetTableManager(StandardTables.ErrorsTable)).Returns(managerMock.Object);

            selectionService ??= Mock.Of <IIssueSelectionService>();

            return(new SonarErrorListDataSource(providerMock.Object, Mock.Of <IFileRenamesEventSource>(), selectionService));
        }
        private static HotspotsControlViewModel CreateTestSubject(ObservableCollection <IAnalysisIssueVisualization> originalCollection = null,
                                                                  ILocationNavigator locationNavigator    = null,
                                                                  Mock <IHotspotsStore> hotspotsStore     = null,
                                                                  IIssueSelectionService selectionService = null)
        {
            originalCollection ??= new ObservableCollection <IAnalysisIssueVisualization>();
            var readOnlyWrapper = new ReadOnlyObservableCollection <IAnalysisIssueVisualization>(originalCollection);

            hotspotsStore ??= new Mock <IHotspotsStore>();
            hotspotsStore.Setup(x => x.GetAll()).Returns(readOnlyWrapper);

            selectionService ??= Mock.Of <IIssueSelectionService>();

            return(new HotspotsControlViewModel(hotspotsStore.Object, locationNavigator, selectionService));
        }
        private AnalysisIssueSelectionService CreateTestSubject(
            IVsMonitorSelection monitorSelection    = null,
            IIssueSelectionService selectionService = null)
        {
            monitorSelection ??= Mock.Of <IVsMonitorSelection>();
            selectionService ??= Mock.Of <IIssueSelectionService>();

            var serviceProviderMock = new Mock <IServiceProvider>();

            serviceProviderMock
            .Setup(x => x.GetService(typeof(SVsShellMonitorSelection)))
            .Returns(monitorSelection);

            return(new AnalysisIssueSelectionService(serviceProviderMock.Object, selectionService));
        }
        public HotspotsControlViewModel(IHotspotsStore hotspotsStore,
                                        ILocationNavigator locationNavigator,
                                        IIssueSelectionService selectionService)
        {
            AllowMultiThreadedAccessToHotspotsList();

            this.selectionService = selectionService;
            selectionService.SelectedIssueChanged += SelectionService_SelectionChanged;

            this.store           = hotspotsStore;
            store.IssuesChanged += Store_IssuesChanged;

            UpdateHotspotsList();

            SetCommands(hotspotsStore, locationNavigator);
        }
        public IssueLocationActionsSource(ILightBulbBroker lightBulbBroker,
                                          IVsUIShell vsUiShell,
                                          IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService,
                                          ITextView textView,
                                          IIssueSelectionService selectionService)
        {
            this.lightBulbBroker  = lightBulbBroker;
            this.vsUiShell        = vsUiShell;
            this.textView         = textView;
            this.selectionService = selectionService;

            issueLocationsTagAggregator              = bufferTagAggregatorFactoryService.CreateTagAggregator <IIssueLocationTag>(textView.TextBuffer);
            issueLocationsTagAggregator.TagsChanged += TagAggregator_TagsChanged;

            selectedIssueLocationsTagAggregator              = bufferTagAggregatorFactoryService.CreateTagAggregator <ISelectedIssueLocationTag>(textView.TextBuffer);
            selectedIssueLocationsTagAggregator.TagsChanged += TagAggregator_TagsChanged;
        }
Esempio n. 12
0
        internal SonarErrorListDataSource(ITableManagerProvider tableManagerProvider,
                                          IFileRenamesEventSource fileRenamesEventSource,
                                          IIssueSelectionService issueSelectionService)
        {
            if (tableManagerProvider == null)
            {
                throw new ArgumentNullException(nameof(tableManagerProvider));
            }

            this.fileRenamesEventSource          = fileRenamesEventSource ?? throw new ArgumentNullException(nameof(fileRenamesEventSource));
            this.issueSelectionService           = issueSelectionService ?? throw new ArgumentNullException(nameof(issueSelectionService));
            fileRenamesEventSource.FilesRenamed += OnFilesRenamed;

            var errorTableManager = tableManagerProvider.GetTableManager(StandardTables.ErrorsTable);

            errorTableManager.AddSource(this, StandardTableColumnDefinitions.DetailsExpander,
                                        StandardTableColumnDefinitions.ErrorSeverity, StandardTableColumnDefinitions.ErrorCode,
                                        StandardTableColumnDefinitions.ErrorSource, StandardTableColumnDefinitions.BuildTool,
                                        StandardTableColumnDefinitions.ErrorSource, StandardTableColumnDefinitions.ErrorCategory,
                                        StandardTableColumnDefinitions.Text, StandardTableColumnDefinitions.DocumentName,
                                        StandardTableColumnDefinitions.Line, StandardTableColumnDefinitions.Column,
                                        StandardTableColumnDefinitions.ProjectName);
        }
Esempio n. 13
0
 public EventProcessor(IWpfTableControl wpfTableControl, IIssueSelectionService selectionService)
 {
     this.wpfTableControl  = wpfTableControl;
     this.selectionService = selectionService;
 }
Esempio n. 14
0
 internal VSTableEventProcessorProvider(IIssueSelectionService selectionService)
 {
     this.selectionService = selectionService;
 }
 public SelectIssueVisualizationAction(IVsUIShell vsUiShell, IIssueSelectionService selectionService, IAnalysisIssueVisualization issueVisualization)
 {
     this.vsUiShell        = vsUiShell;
     this.selectionService = selectionService;
     Issue = issueVisualization;
 }
Esempio n. 16
0
 public DeselectIssueVisualizationAction(IIssueSelectionService selectionService)
 {
     this.selectionService     = selectionService;
     cachedSelectedIssueRuleId = selectionService.SelectedIssue.RuleId;
 }
Esempio n. 17
0
 private SelectedVisualizationValidityMonitor CreateTestSubject(IIssueLocationStoreAggregator storeAggregator, IIssueSelectionService selectionService = null)
 {
     selectionService ??= Mock.Of <IIssueSelectionService>();
     return(new SelectedVisualizationValidityMonitor(selectionService, storeAggregator));
 }