public PreCompiledHeadersEventListener(ICFamilyAnalyzer cFamilyAnalyzer, IActiveDocumentTracker activeDocumentTracker, IScheduler scheduler, ISonarLanguageRecognizer sonarLanguageRecognizer) : this(cFamilyAnalyzer, activeDocumentTracker, scheduler, sonarLanguageRecognizer, new EnvironmentSettings(), new PchCacheCleaner(new FileSystem(), CFamilyHelper.PchFilePath)) { }
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)); }
internal PreCompiledHeadersEventListener(ICFamilyAnalyzer cFamilyAnalyzer, IActiveDocumentTracker activeDocumentTracker, IScheduler scheduler, ISonarLanguageRecognizer sonarLanguageRecognizer, IEnvironmentSettings environmentSettings, IPchCacheCleaner pchCacheCleaner) { this.cFamilyAnalyzer = cFamilyAnalyzer; this.activeDocumentTracker = activeDocumentTracker; this.scheduler = scheduler; this.sonarLanguageRecognizer = sonarLanguageRecognizer; this.pchCacheCleaner = pchCacheCleaner; pchJobTimeoutInMilliseconds = environmentSettings.PCHGenerationTimeoutInMs(60 * 1000); activeDocumentTracker.OnDocumentFocused += OnActiveDocumentFocused; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.contentPresenter = GetTemplateChild("PART_SelectedContentHost") as ContentPresenter; if (this.contentPresenter != null) { this.SetBinding(ActiveContentProperty, new Binding { Source = this.contentPresenter, Path = new PropertyPath(ContentPresenter.ContentProperty) }); } this.documentCombo = GetTemplateChild("PART_DocumentCombo") as ComboBox; if (this.documentCombo != null && this.ServiceProvider != null) { this.activeDocumentTracker = this.ServiceProvider.GetService(typeof(IActiveDocumentTracker)) as IActiveDocumentTracker; if (this.activeDocumentTracker != null) { this.activeDocumentTracker.ActiveDocumentChanged += OnActiveDocumentChanged; this.Unloaded += OnUnloaded; } } }
void OnMainWindowClosed(object sender, EventArgs e) { this.thisWindow.Dispatcher.BeginInvoke((Action)(() => { // We need to re-establish the main window. It might even be us now! this.mainWindowDocumentTracker.ActiveDocumentChanged -= OnMainWindowActiveDocumentChanged; this.mainWindow.Closed -= OnMainWindowClosed; this.mainWindow = ToolsUIApplication.Instance.MainToolsUIWindow; if (this.thisWindow != this.mainWindow) { this.mainWindowDocumentTracker = this.mainWindow.ServiceProvider.GetService(typeof(IActiveDocumentTracker)) as IActiveDocumentTracker; } else { this.mainWindowDocumentTracker = null; } if (this.mainWindowDocumentTracker != null) { this.mainWindowDocumentTracker.ActiveDocumentChanged += OnMainWindowActiveDocumentChanged; this.activeDocumentCookie.WrappedDocument = this.mainWindowDocumentTracker.ActiveDocument; this.IsTrackingMainWindow = true; this.mainWindow.Closed += OnMainWindowClosed; } else { this.documentList.Remove(this.activeDocumentCookie); this.activeDocumentCookie = null; this.IsTrackingMainWindow = false; AssignShortcuts(); } }), DispatcherPriority.Background); }
public WindowDocumentTracker(ToolsUIWindow window, IServiceProvider serviceProvider) : base(serviceProvider) { this.thisWindow = window; this.mainWindow = ToolsUIApplication.Instance.MainToolsUIWindow ?? window; // If MainToolsUIWindow is null, the window is (about to be) the main window this.documentList = new ObservableCollection<DocumentWrapper>(); if (this.thisWindow != this.mainWindow) { // This is not the main window. All secondary windows are born tracking the main window's // active document. this.mainWindowDocumentTracker = this.mainWindow.ServiceProvider.GetService(typeof(IActiveDocumentTracker)) as IActiveDocumentTracker; if (this.mainWindowDocumentTracker != null) { this.mainWindowDocumentTracker.ActiveDocumentChanged += OnMainWindowActiveDocumentChanged; this.activeDocumentCookie = new ActiveDocumentCookie(this.thisWindow); this.activeDocument = this.mainWindowDocumentTracker.ActiveDocument; this.activeDocumentCookie.WrappedDocument = this.mainWindowDocumentTracker.ActiveDocument; this.isTrackingMainWindow = true; this.mainWindow.Closed += OnMainWindowClosed; } } this.documentListAsINCC = this.DocumentManager.Documents as INotifyCollectionChanged; if (this.documentListAsINCC != null) { this.documentListAsINCC.CollectionChanged += OnDocumentListChanged; } InitializeDocumentList(); this.selectedDocument = this.activeDocumentCookie ?? this.documentList.FirstOrDefault(d => d.WrappedDocument == this.activeDocument); }