예제 #1
0
        public CodeSearchController(
            CodeSearchControl control,
            IDispatchThreadServerRequestExecutor dispatchThreadServerRequestExecutor,
            IDispatchThreadDelayedOperationExecutor dispatchThreadDelayedOperationExecutor,
            IFileSystemTreeSource fileSystemTreeSource,
            ITypedRequestProcessProxy typedRequestProcessProxy,
            IProgressBarTracker progressBarTracker,
            IStandarImageSourceFactory standarImageSourceFactory,
            IWindowsExplorer windowsExplorer,
            IClipboard clipboard,
            ISynchronizationContextProvider synchronizationContextProvider,
            IOpenDocumentHelper openDocumentHelper,
            ITextDocumentTable textDocumentTable,
            IDispatchThreadEventBus eventBus,
            IGlobalSettingsProvider globalSettingsProvider,
            IBuildOutputParser buildOutputParser,
            IVsEditorAdaptersFactoryService adaptersFactoryService,
            IShowServerInfoService showServerInfoService)
        {
            _control = control;
            _dispatchThreadServerRequestExecutor = dispatchThreadServerRequestExecutor;
            _fileSystemTreeSource      = fileSystemTreeSource;
            _typedRequestProcessProxy  = typedRequestProcessProxy;
            _progressBarTracker        = progressBarTracker;
            _standarImageSourceFactory = standarImageSourceFactory;
            _windowsExplorer           = windowsExplorer;
            _clipboard = clipboard;
            _synchronizationContextProvider = synchronizationContextProvider;
            _openDocumentHelper             = openDocumentHelper;
            _eventBus = eventBus;
            _globalSettingsProvider            = globalSettingsProvider;
            _buildOutputParser                 = buildOutputParser;
            _adaptersFactoryService            = adaptersFactoryService;
            _showServerInfoService             = showServerInfoService;
            _searchResultDocumentChangeTracker = new SearchResultsDocumentChangeTracker(
                dispatchThreadDelayedOperationExecutor,
                textDocumentTable);
            _taskCancellation = new TaskCancellation();

            // Ensure initial values are in sync.
            GlobalSettingsOnPropertyChanged(null, null);

            // Ensure changes to ViewModel are synchronized to global settings
            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;

            // Ensure changes to global settings are synchronized to ViewModel
            _globalSettingsProvider.GlobalSettings.PropertyChanged += GlobalSettingsOnPropertyChanged;

            _eventBusCookie1 = _eventBus.RegisterHandler(EventNames.TextDocument.DocumentOpened, TextDocumentOpenHandler);
            _eventBusCookie2 = _eventBus.RegisterHandler(EventNames.TextDocument.DocumentClosed, TextDocumentClosedHandler);
            _eventBusCookie3 = _eventBus.RegisterHandler(EventNames.TextDocument.DocumentFileActionOccurred, TextDocumentFileActionOccurred);

            typedRequestProcessProxy.EventReceived += TypedRequestProcessProxy_OnEventReceived;

            dispatchThreadServerRequestExecutor.ProcessFatalError += DispatchThreadServerRequestExecutor_OnProcessFatalError;

            fileSystemTreeSource.TreeReceived  += FileSystemTreeSource_OnTreeReceived;
            fileSystemTreeSource.ErrorReceived += FileSystemTreeSource_OnErrorReceived;
        }
예제 #2
0
        public void Activate()
        {
            IVsSolutionEventsHandler vsSolutionEvents = new VsSolutionEventsHandler(_visualStudioPackageProvider);

            vsSolutionEvents.AfterOpenSolution   += AfterOpenSolutionHandler;
            vsSolutionEvents.BeforeCloseSolution += BeforeCloseSolutionHandler;

            _fileSystemTreeSource.TreeReceived  += OnTreeReceived;
            _fileSystemTreeSource.ErrorReceived += OnErrorReceived;

            var mcs = _visualStudioPackageProvider.Package.OleMenuCommandService;

            if (mcs != null)
            {
                var cmd = new SimplePackageCommandHandler(
                    new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidSyncWithActiveDocument),
                    enabled: () => !_hierarchy.IsEmpty,
                    visible: () => _globalSettingsProvider.GlobalSettings.EnableSourceExplorerHierarchy && !_hierarchy.IsEmpty,
                    execute: (s, e) => SyncToActiveDocument());
                mcs.AddCommand(cmd.ToOleMenuCommand());
            }

            RegisterHierarchyCommands(_hierarchy);

            _nodeTemplateFactory.Activate();
            _eventBus.RegisterHandler(EventNames.SolutionExplorer.ShowFile, ShowInSolutionExplorerHandler);

            _globalSettingsProvider.GlobalSettings.PropertyChanged += GlobalSettingsOnPropertyChanged;
            SynchronizeHierarchy();
        }
예제 #3
0
        private GlobalSettings CreateGlobalSettings()
        {
            var result = new GlobalSettings();

            CopyOptionsPagesToGlobalSettings(result);

            // Ensure changes to the GlobalSettings object are save to the VS Settings.
            result.PropertyChanged += GlobalSettingsPropertyChangedHandler;

            // Ensure changes to the VS Settings are reflected to the GlobalSettings object.
            _eventBus.RegisterHandler(EventNames.ToolsOptions.PageApply, ToolsOptionsPageApplyHandler);

            return(result);
        }