Exemple #1
0
        public TextSearchNavigator(ITextSearchService2 textSearchService, ITextBuffer buffer)
        {
            _buffer            = buffer;
            _textSearchService = textSearchService;

            _buffer.Changed += this.OnTextBufferChanged;
        }
Exemple #2
0
		public SearchService(IWpfTextView wpfTextView, ITextSearchService2 textSearchService2, ISearchSettings searchSettings, IMessageBoxManager messageBoxManager, ITextStructureNavigator textStructureNavigator, Lazy<IReplaceListenerProvider>[] replaceListenerProviders) {
			if (wpfTextView == null)
				throw new ArgumentNullException(nameof(wpfTextView));
			if (textSearchService2 == null)
				throw new ArgumentNullException(nameof(textSearchService2));
			if (searchSettings == null)
				throw new ArgumentNullException(nameof(searchSettings));
			if (messageBoxManager == null)
				throw new ArgumentNullException(nameof(messageBoxManager));
			if (textStructureNavigator == null)
				throw new ArgumentNullException(nameof(textStructureNavigator));
			if (replaceListenerProviders == null)
				throw new ArgumentNullException(nameof(replaceListenerProviders));
			this.wpfTextView = wpfTextView;
			this.textSearchService2 = textSearchService2;
			this.searchSettings = searchSettings;
			this.messageBoxManager = messageBoxManager;
			this.textStructureNavigator = textStructureNavigator;
			this.replaceListenerProviders = replaceListenerProviders;
			this.listeners = new List<ITextMarkerListener>();
			this.searchString = string.Empty;
			this.replaceString = string.Empty;
			this.searchKind = SearchKind.None;
			this.searchControlPosition = SearchControlPosition.Default;
			wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (s, e) => ShowFind()));
			wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Replace, (s, e) => ShowReplace()));
			wpfTextView.Closed += WpfTextView_Closed;
			UseGlobalSettings(true);
		}
Exemple #3
0
 public MarkdownBar(IWpfTextView view, ITextSearchService2 textSearch)
 {
     _View          = view;
     _TextSearch    = textSearch;
     _ListContainer = _View.Properties.GetOrCreateSingletonProperty(() => new ExternalAdornment(view));
     _Tags          = _View.Properties.GetProperty <TaggerResult>(typeof(TaggerResult));
     Name           = nameof(MarkdownBar);
     this.SetBackgroundForCrispImage(ThemeHelper.TitleBackgroundColor);
     view.Properties.AddProperty(nameof(NaviBar), this);
     view.Selection.SelectionChanged += Update;
     view.TextBuffer.PostChanged     += Update;
     view.Closed += View_Closed;
     Resources    = SharedDictionaryManager.Menu;
     SetResourceReference(BackgroundProperty, VsBrushes.CommandBarMenuBackgroundGradientKey);
     SetResourceReference(ForegroundProperty, VsBrushes.CommandBarTextInactiveKey);
     _ActiveTitleLabel     = new ThemedToolBarText(DefaultActiveTitle);
     Items.Add(_ActiveItem = new ThemedButton(new StackPanel {
         Orientation = Orientation.Horizontal,
         Children    = { ThemeHelper.GetImage(KnownImageIds.PageHeader), _ActiveTitleLabel }
     }, null, ShowTitleList)
     {
         Padding = WpfHelper.SmallMargin
     });
     //AddItem(KnownImageIds.Bold, ToggleBold);
     //AddItem(KnownImageIds.Italic, ToggleItalic);
     //AddItem(KnownImageIds.MarkupTag, ToggleCode);
     //AddItem(KnownImageIds.HyperLink, ToggleHyperLink);
     //AddItem(KnownImageIds.StrikeThrough, ToggleStrikeThrough);
 }
		SearchServiceProvider(ITextSearchService2 textSearchService2, ITextStructureNavigatorSelectorService textStructureNavigatorSelectorService, ISearchSettings searchSettings, IMessageBoxService messageBoxService, [ImportMany] IEnumerable<Lazy<IReplaceListenerProvider>> replaceListenerProviders, IEditorOperationsFactoryService editorOperationsFactoryService) {
			this.textSearchService2 = textSearchService2;
			this.textStructureNavigatorSelectorService = textStructureNavigatorSelectorService;
			this.searchSettings = searchSettings;
			this.messageBoxService = messageBoxService;
			this.replaceListenerProviders = replaceListenerProviders.ToArray();
			this.editorOperationsFactoryService = editorOperationsFactoryService;
		}
Exemple #5
0
 SearchServiceProvider(ITextSearchService2 textSearchService2, ITextStructureNavigatorSelectorService textStructureNavigatorSelectorService, ISearchSettings searchSettings, IMessageBoxService messageBoxService, [ImportMany] IEnumerable <Lazy <IReplaceListenerProvider> > replaceListenerProviders)
 {
     this.textSearchService2 = textSearchService2;
     this.textStructureNavigatorSelectorService = textStructureNavigatorSelectorService;
     this.searchSettings           = searchSettings;
     this.messageBoxService        = messageBoxService;
     this.replaceListenerProviders = replaceListenerProviders.ToArray();
 }
Exemple #6
0
		public TextSearchNavigator(ITextBuffer buffer, ITextSearchService2 textSearchService2) {
			if (buffer == null)
				throw new ArgumentNullException(nameof(buffer));
			if (textSearchService2 == null)
				throw new ArgumentNullException(nameof(textSearchService2));
			this.buffer = buffer;
			this.textSearchService2 = textSearchService2;
		}
Exemple #7
0
 public RHistoryProvider(ICoreShell coreShell)
 {
     _textBufferFactory          = coreShell.GetService <ITextBufferFactoryService>();
     _contentTypeRegistryService = coreShell.GetService <IContentTypeRegistryService>();
     _editorOperationsFactory    = coreShell.GetService <IEditorOperationsFactoryService>();
     _rtfBuilderService          = coreShell.GetService <IRtfBuilderService>();
     _textSearchService          = coreShell.GetService <ITextSearchService2>();
     _settings  = coreShell.GetService <IRSettings>();
     _histories = new Dictionary <ITextBuffer, IRHistory>();
 }
Exemple #8
0
 public RHistoryProvider(ITextBufferFactoryService textBufferFactory, IContentTypeRegistryService contentTypeRegistryService, IEditorOperationsFactoryService editorOperationsFactory, IRtfBuilderService rtfBuilderService, ITextSearchService2 textSearchService, IRSettings settings)
 {
     _textBufferFactory       = textBufferFactory;
     _editorOperationsFactory = editorOperationsFactory;
     _rtfBuilderService       = rtfBuilderService;
     _textSearchService       = textSearchService;
     _settings                   = settings;
     _rtfBuilderService          = rtfBuilderService;
     _contentTypeRegistryService = contentTypeRegistryService;
     _histories                  = new Dictionary <ITextBuffer, IRHistory>();
 }
 public RHistoryProvider(ITextBufferFactoryService textBufferFactory, IContentTypeRegistryService contentTypeRegistryService, IFileSystem fileSystem, IEditorOperationsFactoryService editorOperationsFactory, IRtfBuilderService rtfBuilderService, ITextSearchService2 textSearchService, IRSettings settings) {
     _textBufferFactory = textBufferFactory;
     _fileSystem = fileSystem;
     _editorOperationsFactory = editorOperationsFactory;
     _rtfBuilderService = rtfBuilderService;
     _textSearchService = textSearchService;
     _settings = settings;
     _rtfBuilderService = rtfBuilderService;
     _contentType = contentTypeRegistryService.GetContentType(RHistoryContentTypeDefinition.ContentType);
     _histories = new Dictionary<ITextBuffer, IRHistory>();
 }
Exemple #10
0
 public RHistoryProvider(IServiceContainer services)
 {
     _textBufferFactory          = services.GetService <ITextBufferFactoryService>();
     _contentTypeRegistryService = services.GetService <IContentTypeRegistryService>();
     _editorOperationsFactory    = services.GetService <IEditorOperationsFactoryService>();
     _rtfBuilderService          = services.GetService <IRtfBuilderService>();
     _textSearchService          = services.GetService <ITextSearchService2>();
     _settings  = services.GetService <IRSettings>();
     _histories = new Dictionary <ITextBuffer, IRHistoryVisual>();
     _fs        = services.FileSystem();
 }
Exemple #11
0
 public TextSearchNavigator(ITextBuffer buffer, ITextSearchService2 textSearchService2)
 {
     if (buffer == null)
     {
         throw new ArgumentNullException(nameof(buffer));
     }
     if (textSearchService2 == null)
     {
         throw new ArgumentNullException(nameof(textSearchService2));
     }
     this.buffer             = buffer;
     this.textSearchService2 = textSearchService2;
 }
Exemple #12
0
        public BackgroundSearch(ITextSearchService2 textSearchService, ITextBuffer buffer, string searchTerm, FindOptions options,
                                Func <SnapshotSpan, T> tagFactory, Action <ITextSnapshot, NormalizedSpanCollection> callback)
        {
            _textSearchService = textSearchService;
            _buffer            = buffer;

            _searchTerm     = searchTerm;
            _options        = options & ~FindOptions.SearchReverse; //The tagger ignores the reversed flag.
            this.TagFactory = tagFactory;
            _callback       = callback;

            _results = new SearchResults(_buffer.CurrentSnapshot, NormalizedSpanCollection.Empty, NormalizedSpanCollection.Empty);
        }
        public RHistoryFiltering(IRHistory history, IRHistoryWindowVisualComponent visualComponent, IRSettings settings, ITextSearchService2 textSearchService) {
            _history = history;
            _history.HistoryChanging += HistoryChanging;
            _history.HistoryChanged += HistoryChanged;

            _settings = settings;
            _textSearchService = textSearchService;
            _textView = visualComponent.TextView;
            _textBuffer = _textView.TextDataModel.DataBuffer;

            IElisionBuffer elisionBuffer;
            _textView.TextViewModel.Properties.TryGetProperty(IntraTextAdornmentBufferKey, out elisionBuffer);
            _elisionBuffer = elisionBuffer;
        }
Exemple #14
0
 public MarkdownBar(IWpfTextView view, ITextSearchService2 textSearch) : base(view)
 {
     _TextSearch = textSearch;
     _Tags       = view.Properties.GetProperty <TaggerResult>(typeof(TaggerResult));
     Name        = nameof(MarkdownBar);
     BindView(view);
     _ActiveTitleLabel  = new ThemedToolBarText(DefaultActiveTitle);
     _ActiveItem        = new ThemedImageButton(IconIds.Headings, _ActiveTitleLabel);
     _ActiveItem.Click += ShowTitleList;
     Items.Add(_ActiveItem);
     //AddItem(KnownImageIds.Bold, ToggleBold);
     //AddItem(KnownImageIds.Italic, ToggleItalic);
     //AddItem(KnownImageIds.MarkupTag, ToggleCode);
     //AddItem(KnownImageIds.HyperLink, ToggleHyperLink);
     //AddItem(KnownImageIds.StrikeThrough, ToggleStrikeThrough);
 }
Exemple #15
0
        public RHistoryFiltering(IRHistory history, IRHistoryWindowVisualComponent visualComponent, IRSettings settings, ITextSearchService2 textSearchService)
        {
            _history = history;
            _history.HistoryChanging += HistoryChanging;
            _history.HistoryChanged  += HistoryChanged;

            _settings          = settings;
            _textSearchService = textSearchService;
            _textView          = visualComponent.TextView;
            _textBuffer        = _textView.TextDataModel.DataBuffer;

            IElisionBuffer elisionBuffer;

            _textView.TextViewModel.Properties.TryGetProperty(IntraTextAdornmentBufferKey, out elisionBuffer);
            _elisionBuffer = elisionBuffer;
        }
Exemple #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SmartBar"/> class.
 /// </summary>
 /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
 public SmartBar(IWpfTextView view, ITextSearchService2 textSearchService)
 {
     View = view ?? throw new ArgumentNullException(nameof(view));
     TextSearchService = textSearchService;
     _ToolBarLayer     = view.GetAdornmentLayer(nameof(SmartBar));
     Config.Updated   += ConfigUpdated;
     if (Config.Instance.SmartBarOptions.MatchFlags(SmartBarOptions.ShiftToggleDisplay))
     {
         View.VisualElement.PreviewKeyUp += ViewKeyUp;
     }
     if (Config.Instance.SmartBarOptions.MatchFlags(SmartBarOptions.ManualDisplaySmartBar) == false)
     {
         View.Selection.SelectionChanged += ViewSelectionChanged;
     }
     View.Closed += ViewClosed;
     ToolBar      = new ToolBar {
         BorderThickness = new Thickness(1),
         BorderBrush     = Brushes.Gray,
         Band            = 1,
         IsOverflowOpen  = false
     }.HideOverflow();
     ToolBar.SetResourceReference(Control.BackgroundProperty, VsBrushes.CommandBarGradientBeginKey);
     ToolBar2 = new ToolBar {
         BorderThickness = new Thickness(1),
         BorderBrush     = Brushes.Gray,
         Band            = 2,
         IsOverflowOpen  = false
     }.HideOverflow();
     ToolBar2.SetResourceReference(Control.BackgroundProperty, VsBrushes.CommandBarGradientBeginKey);
     _ToolBarTray = new ToolBarTray {
         ToolBars          = { ToolBar, ToolBar2 },
         IsLocked          = true,
         Cursor            = Cursors.Arrow,
         Background        = Brushes.Transparent,
         UseLayoutRounding = true
     };
     _ToolBarTray.MouseEnter += ToolBarMouseEnter;
     _ToolBarTray.MouseLeave += ToolBarMouseLeave;
     _ToolBarTray.DragEnter  += HideToolBar;
     _ToolBarLayer.AddAdornment(AdornmentPositioningBehavior.ViewportRelative, null, null, _ToolBarTray, null);
     _ToolBarTray.Visibility = Visibility.Hidden;
 }
 public TextSearchTagger(ITextSearchService2 searchService, ITextBuffer buffer)
 {
     _searchService = searchService;
     _buffer        = buffer;
 }
 TextSearchNavigatorFactoryService(ITextSearchService2 textSearchService2) => this.textSearchService2 = textSearchService2;
 public TextSearchNavigator(ITextSearchService2 textSearchService, ITextBuffer buffer)
 {
     _buffer            = buffer;
     _textSearchService = textSearchService;
 }
Exemple #20
0
 public Overrider(IWpfTextView view, ITextSearchService2 textSearch)
 {
     _View       = view;
     _TextSearch = textSearch;
     view.VisualElement.Loaded += AddNaviBar;
 }
Exemple #21
0
		public SearchService(IWpfTextView wpfTextView, ITextSearchService2 textSearchService2, ISearchSettings searchSettings, IMessageBoxService messageBoxService, ITextStructureNavigator textStructureNavigator, Lazy<IReplaceListenerProvider>[] replaceListenerProviders, IEditorOperationsFactoryService editorOperationsFactoryService) {
			if (wpfTextView == null)
				throw new ArgumentNullException(nameof(wpfTextView));
			if (textSearchService2 == null)
				throw new ArgumentNullException(nameof(textSearchService2));
			if (searchSettings == null)
				throw new ArgumentNullException(nameof(searchSettings));
			if (messageBoxService == null)
				throw new ArgumentNullException(nameof(messageBoxService));
			if (textStructureNavigator == null)
				throw new ArgumentNullException(nameof(textStructureNavigator));
			if (replaceListenerProviders == null)
				throw new ArgumentNullException(nameof(replaceListenerProviders));
			this.wpfTextView = wpfTextView;
			editorOperations = editorOperationsFactoryService.GetEditorOperations(wpfTextView);
			this.textSearchService2 = textSearchService2;
			this.searchSettings = searchSettings;
			this.messageBoxService = messageBoxService;
			this.textStructureNavigator = textStructureNavigator;
			this.replaceListenerProviders = replaceListenerProviders;
			listeners = new List<ITextMarkerListener>();
			searchString = string.Empty;
			replaceString = string.Empty;
			searchKind = SearchKind.None;
			searchControlPosition = SearchControlPosition.Default;
			wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (s, e) => ShowFind()));
			wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Replace, (s, e) => ShowReplace()));
			wpfTextView.Closed += WpfTextView_Closed;
			UseGlobalSettings(true);
		}
Exemple #22
0
 public CppSmartBar(IWpfTextView textView, ITextSearchService2 textSearchService) : base(textView, textSearchService)
 {
     _TextStructureNavigator = ServicesHelper.Instance.TextStructureNavigator.GetTextStructureNavigator(textView.TextBuffer);
 }
		TextSearchNavigatorFactoryService(ITextSearchService2 textSearchService2) {
			this.textSearchService2 = textSearchService2;
		}