Пример #1
0
 private void SetSelectionsFromHistory(Dictionary <int, List <HistorySelection> > selectionHistory)
 {
     if (selectionHistory.TryGetValue(Snapshot.Version.ReiteratedVersionNumber, out var selections))
     {
         Selections = HistoryManager.CreateSelections(Snapshot, selections);
     }
     else
     {
         DiscardSelections();
     }
 }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Selector"/> class.
        /// </summary>
        /// <param name="view"></param>
        /// <param name="textSearchService"></param>
        /// <param name="editorOperationsService"></param>
        /// <param name="textStructureNavigator"></param>
        /// <param name="outliningManagerService"></param>
        public Selector(
            IWpfTextView view,
            ITextSearchService textSearchService,
            IEditorOperationsFactoryService editorOperationsService,
            ITextStructureNavigator textStructureNavigator,
            IOutliningManagerService outliningManagerService)
        {
            this.view = view;

            // Services
            this.textSearchService      = textSearchService;
            this.EditorOperations       = editorOperationsService.GetEditorOperations(this.view);
            this.textStructureNavigator = textStructureNavigator;
            this.outliningManager       = outliningManagerService?.GetOutliningManager(this.view);
            this.Dte = ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE2;

            this.Selections     = new List <Selection>();
            this.historyManager = new HistoryManager();
        }