Exemplo n.º 1
0
        internal SelectionHighlight(IWpfTextView view, ITextSearchService TextSearchService, ITagAggregator <ToDoTag> tagAggregator)
        {
            this._view                        = view;
            this._layer                       = view.GetAdornmentLayer("SelectionHighlight");
            this._selection                   = view.Selection;
            this._textSearchService           = TextSearchService;
            this._tagAggregator               = tagAggregator;
            this._view.LayoutChanged         += this.OnLayoutChanged;
            this._selection.SelectionChanged += new EventHandler(this.OnSelectionChanged);
            //不可启用,有可能会与StructureAdornmentManager 类中的注册的Closed事件冲突
            //this._view.Closed += TextView_Closed;

            ThreadHelper.ThrowIfNotOnUIThread();

            //选中单词区域背景色
            Brush brush = new SolidColorBrush(Colors.DarkOrchid);

            //Brush brush = new SolidColorBrush(Colors.OrangeRed);
            brush.Freeze();
            Brush brush2 = new SolidColorBrush(Colors.AliceBlue);

            brush2.Freeze();
            Pen pen = new Pen(brush2, 0.5);

            pen.Freeze();
            this._brush = brush;
            this._pen   = pen;
        }
Exemplo n.º 2
0
        public LoggingTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService,
                             ITextStructureNavigator textStructureNavigator,
                             IToolTipProviderFactory toolTipProviderFactory)
        {
            _sourceBuffer           = sourceBuffer;
            _view                   = view;
            _textSearchService      = textSearchService;
            _textStructureNavigator = textStructureNavigator;
            // Subscribe to both change events in the view - any time the view is updated
            // or the caret is moved, we refresh our list of highlighted words.
            _view.Caret.PositionChanged += CaretPositionChanged;
            _view.LayoutChanged         += ViewLayoutChanged;
            _toolTipProvider             = toolTipProviderFactory.GetToolTipProvider(_view);
            if (_view == ToolWindow1Control.CurrentTextViewer)
            {
                UpdateAtCaretPosition(_view.Caret.ContainingTextViewLine);
            }

            // TODO: syncronized access.
            if (LoggingTaggerCollection == null)
            {
                LoggingTaggerCollection = new Dictionary <ITextView, LoggingTagger>();
            }
            if (!LoggingTaggerCollection.ContainsKey(view))
            {
                LoggingTaggerCollection.Add(view, this);
            }
            else
            {
                LoggingTaggerCollection[view] = this;
            }
        }
Exemplo n.º 3
0
        public HighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator)
        {
            this.View                   = view;
            this.SourceBuffer           = sourceBuffer;
            this.TextSearchService      = textSearchService;
            this.TextStructureNavigator = textStructureNavigator;
            this.WordSpans              = new NormalizedSnapshotSpanCollection();
            this.CurrentWord            = null;
            // START - 20150224 by MXK
            // START - 20140117 by kicko (http://ax2012editorext.codeplex.com/discussions/452826)
            //this.View.Selection.SelectionChanged += new EventHandler(SelectionChanged);
            // END - 20140117 by kicko

            this.LoadSettings();

            if (this.EnableWH)
            {
                if (this.SelectedWord)
                {
                    this.View.Selection.SelectionChanged += new EventHandler(SelectionChanged);
                }
                else
                {
                    this.View.Caret.PositionChanged += CaretPositionChanged;
                }
            }
            // END - 20150224 by MXK
            this.View.LayoutChanged += ViewLayoutChanged;
        }
Exemplo n.º 4
0
        public HighlightWordTagger(ITextView view, ITextBuffer buffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator)
        {
            this.view_                   = view ?? throw new ArgumentNullException(nameof(view));
            this.sourceBuffer_           = buffer ?? throw new ArgumentNullException(nameof(buffer));
            this.textSearchService_      = textSearchService ?? throw new ArgumentNullException(nameof(textSearchService));
            this.textStructureNavigator_ = textStructureNavigator ?? throw new ArgumentNullException(nameof(textStructureNavigator));

            if (buffer.CurrentSnapshot.LineCount < AsmDudeToolsStatic.MaxFileLines)
            {
                this.wordSpans_ = new NormalizedSnapshotSpanCollection();

                this.CurrentWord      = null;
                this.currentWordSpan_ = null;
                this.NewWord          = null;
                this.NewWordSpan      = null;

                // Subscribe to both change events in the view - any time the view is updated
                // or the caret is moved, we refresh our list of highlighted words.
                this.view_.Caret.PositionChanged += this.CaretPositionChanged;
                this.view_.LayoutChanged         += this.ViewLayoutChanged;
            }
            else
            {
                AsmDudeToolsStatic.Output_WARNING(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:HighlightWordTagger; file {1} contains {2} lines which is more than maxLines {3}; switching off word highlighting", this.ToString(), AsmDudeToolsStatic.GetFilename(buffer), buffer.CurrentSnapshot.LineCount, AsmDudeToolsStatic.MaxFileLines));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new instance of CBRTagger
        /// </summary>
        /// <param name="provider">the CBETaggerProvider that created the tagger</param>
        /// <param name="textView">the WpfTextView this tagger is assigned to</param>
        /// <param name="sourceBuffer">the TextBuffer this tagger should work with</param>
        internal CBETagger(CBETaggerProvider provider, IWpfTextView textView)
        {
            if (provider == null || textView == null)
            {
                throw new ArgumentNullException("The arguments of CBETagger can't be null");
            }

            _TextView = textView;

            // Getting services provided by VisualStudio
            _TextStructureNavigator = provider.GetTextStructureNavigator(_TextView.TextBuffer);
            _TextSearchService      = provider.TextSearchService;
            _VSFontsInformation     = TryGetFontAndColorInfo(provider.VsFontsAndColorsInformationService);

            // Hook up events
            _TextView.TextBuffer.Changed    += TextBuffer_Changed;
            _TextView.LayoutChanged         += OnTextViewLayoutChanged;
            _TextView.Caret.PositionChanged += Caret_PositionChanged;

            // Listen for package events
            InitializePackage();

            if (_VSFontsInformation != null)
            {
                ReloadFontSize();
                _VSFontsInformation.Updated += _VSFontsInformation_Updated;
            }
        }
        internal GLSLHighlighter(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator, ITagAggregator <IGLSLTag> aggregator)
        {
            _view                   = view;
            _buffer                 = sourceBuffer;
            _textSearchService      = textSearchService;
            _textStructureNavigator = textStructureNavigator;
            _aggregator             = aggregator;

            _aggregator.TagsChanged += (s, args) =>
            {
                var spans = args.Span.GetSpans(_buffer);
                foreach (var span in spans)
                {
                    TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(span));
                }
            };

            _view.LayoutChanged += (s, args) =>
            {
                if (args.NewSnapshot != args.OldSnapshot)
                {
                    UpdateAtCaretPosition(_view.Caret.Position);
                }
            };
            _view.Caret.PositionChanged += (s, args) => UpdateAtCaretPosition(args.NewPosition);
        }
 public RegionTagger(ITextView view, ITextSearchService searchService, IClassificationType type)
 {
     m_View                    = view;
     m_SearchService           = searchService;
     m_Type                    = type;
     m_CurrentSpans            = GetWordSpans(m_View.TextSnapshot);
     m_View.GotAggregateFocus += SetupSelectionChangedListener;
 }
Exemplo n.º 8
0
 // Token: 0x06000012 RID: 18 RVA: 0x000022D4 File Offset: 0x000004D4
 public StickyHighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator)
 {
     this.View                   = view;
     this.SourceBuffer           = sourceBuffer;
     this.TextSearchService      = textSearchService;
     this.TextStructureNavigator = textStructureNavigator;
     this.View.LayoutChanged    += this.ViewLayoutChanged;
     this.WordSpanMap            = new Dictionary <string, NormalizedSnapshotSpanCollection>();
     HighlightedWordCollection.Instance.Changed += this.HighlightWordAdded;
 }
 public HighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService)
 {
     _view              = view;
     _sourceBuffer      = sourceBuffer;
     _textSearchService = textSearchService;
     _wordSpans         = new NormalizedSnapshotSpanCollection();
     _currentWord       = "";
     _highlightWordTag  = new HighlightWordTag();
     _view.Selection.SelectionChanged += ViewSelectionChanged;
 }
Exemplo n.º 10
0
 public SelectionTagger(ITextView view, ITextBuffer SourceBuffer, IClassifier aggregator, ITextSearchService TextSearchService)
 {
     this._view                        = view;
     this._selection                   = view.Selection;
     this._aggregator                  = aggregator;
     this._sourceBuffer                = SourceBuffer;
     this._textSearchService           = TextSearchService;
     this.glyphsToPlace                = new List <SnapshotSpan>();
     this._selection.SelectionChanged += new EventHandler(this.OnSelectionChanged);
     this._view.LayoutChanged         += this.OnLayoutChanged;
 }
Exemplo n.º 11
0
 public IncrementalSearch(ITextView textView, ITextSearchService textSearchService, IEditorOperationsFactoryService editorOperationsFactoryService)
 {
     if (editorOperationsFactoryService == null)
     {
         throw new ArgumentNullException(nameof(editorOperationsFactoryService));
     }
     TextView = textView ?? throw new ArgumentNullException(nameof(textView));
     this.textSearchService = textSearchService ?? throw new ArgumentNullException(nameof(textSearchService));
     editorOperations       = editorOperationsFactoryService.GetEditorOperations(textView);
     SearchString           = string.Empty;
 }
 public AccentFontTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, IClassificationTypeRegistryService typeService)
 {
     this.View              = view;
     this.SourceBuffer      = sourceBuffer;
     this.TextSearchService = textSearchService;
     this.TypeService       = typeService;
     this.WordSpans         = new NormalizedSnapshotSpanCollection();
     this.CurrentWord       = null;
     this.HasAdornments     = false;
     this.View.Selection.SelectionChanged += ViewSelectionChanged;
 }
Exemplo n.º 13
0
 public CssHighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator)
 {
     this._view                        = view;
     this._buffer                      = sourceBuffer;
     this._textSearchService           = textSearchService;
     this._textStructureNavigator      = textStructureNavigator;
     this._wordSpans                   = new NormalizedSnapshotSpanCollection();
     this._currentWord                 = null;
     this._view.Caret.PositionChanged += CaretPositionChanged;
     this._view.LayoutChanged         += ViewLayoutChanged;
 }
Exemplo n.º 14
0
 public HighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator, IClassifierAggregatorService aggregator)
 {
     _aggregator                      = aggregator;
     this.View                        = view;
     this.SourceBuffer                = sourceBuffer;
     this.TextSearchService           = textSearchService;
     this.TextStructureNavigator      = textStructureNavigator;
     this.WordSpans                   = new NormalizedSnapshotSpanCollection();
     this.CurrentWord                 = null;
     this.View.Caret.PositionChanged += CaretPositionChanged;
     this.View.LayoutChanged         += ViewLayoutChanged;
 }
Exemplo n.º 15
0
 public LoggingTagger33(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService,
                        ITextStructureNavigator textStructureNavigator)
 {
     _sourceBuffer           = sourceBuffer;
     _view                   = view;
     _textSearchService      = textSearchService;
     _textStructureNavigator = textStructureNavigator;
     // Subscribe to both change events in the view - any time the view is updated
     // or the caret is moved, we refresh our list of highlighted words.
     _view.Caret.PositionChanged += CaretPositionChanged;
     _view.LayoutChanged         += ViewLayoutChanged;
 }
Exemplo n.º 16
0
        public SnippetEditorForm()
        {
            snippetImports.CollectionChanged              += snippet_CollectionChanged;
            snippetReferences.CollectionChanged           += snippet_CollectionChanged;
            snippetAlternativeShortcuts.CollectionChanged += snippet_CollectionChanged;
            reservedReplacements.Add("end");
            reservedReplacements.Add("selected");

            textSearchService = SnippetDesignerPackage.Instance.ComponentModel.GetService <ITextSearchService>();

            validPotentialReplacementRegex = SnippetRegexPatterns.BuildValidPotentialReplacementRegex();
        }
Exemplo n.º 17
0
		public IncrementalSearch(ITextView textView, ITextSearchService textSearchService, IEditorOperationsFactoryService editorOperationsFactoryService) {
			if (textView == null)
				throw new ArgumentNullException(nameof(textView));
			if (textSearchService == null)
				throw new ArgumentNullException(nameof(textSearchService));
			if (editorOperationsFactoryService == null)
				throw new ArgumentNullException(nameof(editorOperationsFactoryService));
			TextView = textView;
			this.textSearchService = textSearchService;
			editorOperations = editorOperationsFactoryService.GetEditorOperations(textView);
			SearchString = string.Empty;
		}
Exemplo n.º 18
0
        public LinkViewerLinkTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator)
        {
            this.View                   = view;
            this.SourceBuffer           = sourceBuffer;
            this.TextSearchService      = textSearchService;
            this.TextStructureNavigator = textStructureNavigator;
            this.WordSpans              = new NormalizedSnapshotSpanCollection();
            this.CurrentWord            = null;

            this.View.Caret.PositionChanged += Caret_PositionChanged;
            this.View.LayoutChanged         += ViewOnLayoutChanged;
        }
Exemplo n.º 19
0
        public void Create(params string[] lines)
        {
            _textBuffer = EditorUtil.CreateTextBuffer(lines);
            _navigator = VimUtil.CreateTextStructureNavigator(_textBuffer, WordKind.NormalWord);
            _globalSettings = new Vim.GlobalSettings();
            _globalSettings.Magic = true;
            _globalSettings.IgnoreCase = true;
            _globalSettings.SmartCase = false;

            _textSearch = EditorUtil.FactoryService.TextSearchService;
            _searchRaw = new SearchService(_textSearch, _globalSettings);
            _search = _searchRaw;
        }
Exemplo n.º 20
0
        public virtual void Create(ITextSearchService textSearchService, params string[] lines)
        {
            _textBuffer                = CreateTextBuffer(lines);
            _wordNavigator             = WordUtil.CreateTextStructureNavigator(WordKind.NormalWord, _textBuffer.ContentType);
            _globalSettings            = Vim.GlobalSettings;
            _globalSettings.Magic      = true;
            _globalSettings.IgnoreCase = true;
            _globalSettings.SmartCase  = false;

            _textSearch = textSearchService;
            _searchRaw  = new SearchService(_textSearch, _globalSettings);
            _search     = _searchRaw;
        }
Exemplo n.º 21
0
 public HighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService,
                            ITextStructureNavigator textStructureNavigator)
 {
     View                        = view;
     SourceBuffer                = sourceBuffer;
     TextSearchService           = textSearchService;
     TextStructureNavigator      = textStructureNavigator;
     RedWordSpans                = new NormalizedSnapshotSpanCollection();
     YellowWordSpans             = new NormalizedSnapshotSpanCollection();
     CurrentWord                 = null;
     View.Caret.PositionChanged += CaretPositionChanged;
     View.LayoutChanged         += ViewLayoutChanged;
 }
 public HighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator)
 {
     View                   = view;
     SourceBuffer           = sourceBuffer;
     TextSearchService      = textSearchService;
     TextStructureNavigator = textStructureNavigator;
     CurrentWord            = null;
     timer                  = new System.Windows.Forms.Timer()
     {
         Interval = 50, Enabled = true
     };
     timer.Tick += new EventHandler(timerTick);
 }
Exemplo n.º 23
0
        public HighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator)
        {
            nodeProvider = (new NodeProviderBroker()).GetNodeProvider(sourceBuffer);

            this.View                        = view;
            this.SourceBuffer                = sourceBuffer;
            this.TextSearchService           = textSearchService;
            this.TextStructureNavigator      = textStructureNavigator;
            this.WordSpans                   = new NormalizedSnapshotSpanCollection();
            this.CurrentWord                 = null;
            this.View.Caret.PositionChanged += CaretPositionChanged;
            this.View.LayoutChanged         += ViewLayoutChanged;
        }
Exemplo n.º 24
0
 public HighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator)
 {
     this.View                   = view;
     this.SourceBuffer           = sourceBuffer;
     this.TextSearchService      = textSearchService;
     this.TextStructureNavigator = textStructureNavigator;
     this.WordSpans              = new NormalizedSnapshotSpanCollection();
     this.CurrentWord            = null;
     // START - 20140117 by kicko (http://ax2012editorext.codeplex.com/discussions/452826)
     this.View.Selection.SelectionChanged += new EventHandler(SelectionChanged);
     // END - 20140117 by kicko
     this.View.LayoutChanged += ViewLayoutChanged;
 }
Exemplo n.º 25
0
        public void Create(params string[] lines)
        {
            _textBuffer = CreateTextBuffer(lines);
            _wordNavigator = WordUtilFactory.GetWordUtil(_textBuffer).CreateTextStructureNavigator(WordKind.NormalWord);
            _globalSettings = Vim.GlobalSettings;
            _globalSettings.Magic = true;
            _globalSettings.IgnoreCase = true;
            _globalSettings.SmartCase = false;

            _textSearch = TextSearchService;
            _searchRaw = new SearchService(_textSearch, _globalSettings);
            _search = _searchRaw;
        }
Exemplo n.º 26
0
        public HighlightWordTagger(IWpfTextView view, IEditorFormatMap format, ITextSearchService searcher, ITextStructureNavigator navigator)
        {
            _view      = view;
            _searcher  = searcher;
            _navigator = navigator;
            _format    = format;

            view.VisualElement.AddHandler(FrameworkElement.MouseLeftButtonDownEvent, new RoutedEventHandler(ViewMouseLeftButtonDown), true);
            view.VisualElement.AddHandler(FrameworkElement.KeyUpEvent, new RoutedEventHandler(ViewKeyUp), true);

            view.Closed += OnViewClosed;
            view.Options.OptionChanged += OnOptionChanged;
        }
        public HighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService,
                                   ITextStructureNavigator textStructureNavigator)
        {
            this.View                   = view;
            this.SourceBuffer           = sourceBuffer;
            this.TextSearchService      = textSearchService;
            this.TextStructureNavigator = textStructureNavigator;
            this.WordSpans              = new List <NormalizedSnapshotSpanCollection>();
            this.View.LayoutChanged    += ViewLayoutChanged;
            HighlightWordsSettingsManager.SettingsChanged += () => { UpdateWordsAdornments(); };

            UpdateAtCaretPosition(this.View.Caret.Position);
        }
Exemplo n.º 28
0
        public void Create(params string[] lines)
        {
            _textBuffer                = EditorUtil.CreateBuffer(lines);
            _navigator                 = VimUtil.CreateTextStructureNavigator(_textBuffer);
            _globalSettings            = new Vim.GlobalSettings();
            _globalSettings.Magic      = true;
            _globalSettings.IgnoreCase = true;
            _globalSettings.SmartCase  = false;

            _textSearch = EditorUtil.FactoryService.TextSearchService;
            _searchRaw  = new SearchService(_textSearch, _globalSettings);
            _search     = _searchRaw;
        }
Exemplo n.º 29
0
 public virtual void Create(ITextSearchService textSearchService, params string[] lines)
 {
     _textBuffer                = CreateTextBuffer(lines);
     _globalSettings            = Vim.GlobalSettings;
     _globalSettings.Magic      = true;
     _globalSettings.IgnoreCase = true;
     _globalSettings.SmartCase  = false;
     _localSettings             = new LocalSettings(_globalSettings);
     _wordUtil   = new WordUtil(_textBuffer, _localSettings);
     _textSearch = textSearchService;
     _searchRaw  = new SearchService(_textSearch, _globalSettings);
     _search     = _searchRaw;
 }
Exemplo n.º 30
0
        public virtual void Create(ITextSearchService textSearchService, params string[] lines)
        {
            _textBuffer = CreateTextBuffer(lines);
            _wordNavigator = WordUtil.CreateTextStructureNavigator(WordKind.NormalWord, _textBuffer.ContentType);
            _globalSettings = Vim.GlobalSettings;
            _globalSettings.Magic = true;
            _globalSettings.IgnoreCase = true;
            _globalSettings.SmartCase = false;

            _textSearch = textSearchService;
            _searchRaw = new SearchService(_textSearch, _globalSettings);
            _search = _searchRaw;
        }
Exemplo n.º 31
0
        public void Create(params string[] lines)
        {
            _textBuffer                = CreateTextBuffer(lines);
            _wordNavigator             = WordUtilFactory.GetWordUtil(_textBuffer).CreateTextStructureNavigator(WordKind.NormalWord);
            _globalSettings            = Vim.GlobalSettings;
            _globalSettings.Magic      = true;
            _globalSettings.IgnoreCase = true;
            _globalSettings.SmartCase  = false;

            _textSearch = TextSearchService;
            _searchRaw  = new SearchService(_textSearch, _globalSettings);
            _search     = _searchRaw;
        }
Exemplo n.º 32
0
        public HighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator, IClassifier classifier)
        {
            View                   = view;
            ViewDispatcher         = ((IWpfTextView)view).VisualElement.Dispatcher;
            SourceBuffer           = sourceBuffer;
            TextSearchService      = textSearchService;
            TextStructureNavigator = textStructureNavigator;
            Classifier             = classifier;

            WordSpans   = new NormalizedSnapshotSpanCollection();
            CurrentWord = null;
            View.Caret.PositionChanged += View_Caret_PositionChanged;
            View.LayoutChanged         += View_LayoutChanged;
        }
Exemplo n.º 33
0
 public HighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService
                            textSearchService, ITextStructureNavigator textStructureNavigator)
 {
     this.View                   = view;
     this.fileFullPath           = GetFileFullPath(view);
     this.SourceBuffer           = sourceBuffer;
     this.TextSearchService      = textSearchService;
     this.TextStructureNavigator = textStructureNavigator;
     this.highlightedEntities    = Enumerable.Empty <HighlightedEntity>();
     this.highlightedSpans       = new NormalizedSnapshotSpanCollection();
     HighlightedEntitySet.GetInstance().entityChanged += OnHighlightedEntityChanged;
     this.View.Caret.PositionChanged += CaretPositionChanged;
     this.View.LayoutChanged         += ViewLayoutChanged;
 }
Exemplo n.º 34
0
        internal MatchTagger(ITextView view, ITextBuffer sourceBuffer, IClassifier aggregator,
                             ITextSearchService textSearchService)
        {
            _view = view;
            var selection = view.Selection;

            Aggregator                  = aggregator;
            _sourceBuffer               = sourceBuffer;
            _textSearchService          = textSearchService;
            _glyphsToPlace              = new List <SnapshotSpan>();
            _glyphsTagged               = new List <ITagSpan <MatchTag> >();
            selection.SelectionChanged += OnSelectionChanged;
            _view.LayoutChanged        += OnLayoutChanged;
        }
Exemplo n.º 35
0
        //public XHighlight(IWpfTextView view, ITextSearchService TextSearchService, ITagAggregator<MatchTag> tagAggregator)
        public XHighlight(IWpfTextView view, ITextSearchService TextSearchService, IClassificationType ftype, IClassificationFormatMap fmap)
        {
            m_formatType = ftype;
            map = fmap;

            this._view = view;
            this._layer = view.GetAdornmentLayer("XHighlighter");
            this._selection = view.Selection;
            this._textSearchService = TextSearchService;
            //this._tagAggregator = tagAggregator;
            this._view.LayoutChanged += new EventHandler<TextViewLayoutChangedEventArgs>(this.OnLayoutChanged);
            this._selection.SelectionChanged += new EventHandler(this.OnSelectionChanged);
            Brush brush1 = (Brush)new SolidColorBrush(Colors.Yellow);
            brush1.Freeze();
            Brush brush2 = (Brush)new SolidColorBrush(Colors.AliceBlue);
            brush2.Freeze();
            Pen pen = new Pen(brush2, 0.5);
            pen.Freeze();
            this._brush = brush1;
            this._pen = pen;
        }
        internal  ProjectSpecificDictionary(Project project, IVsEditorAdaptersFactoryService adaptersFactory, ITextSearchService textSearchService, string dictionaryFileName)
        {
            if (String.IsNullOrEmpty(dictionaryFileName))
                throw new ArgumentException("dictionaryFileName");

            _project = project;
            _adaptersFactory = adaptersFactory;
            _textSearchService = textSearchService;

            // The dictionary file name
            _dictionaryFilePath = dictionaryFileName;

            _dictionaryFileWatcher = new FileSystemWatcher(Path.GetDirectoryName(_dictionaryFilePath), Path.GetFileName(_dictionaryFilePath))
                                         {
                                             IncludeSubdirectories = false,
                                             EnableRaisingEvents = true,
                                         };
            _dictionaryFileWatcher.Changed += DictionaryFileWatcherChangedCreatedOrDeleted;
            _dictionaryFileWatcher.Created += DictionaryFileWatcherChangedCreatedOrDeleted;
            _dictionaryFileWatcher.Deleted += DictionaryFileWatcherChangedCreatedOrDeleted;
            _dictionaryFileWatcher.Renamed += DictionaryFileWatcherRenamed;

            _deferTimer = new DispatcherTimer(DispatcherPriority.ApplicationIdle)
                              {
                                  Interval = new TimeSpan(DeferredReloadDelay)
                              };
            _deferTimer.Tick += (s, e) =>
                                    {
                                        _deferTimer.Stop();
                                        Reload(false);
                                    };

            // Load the dictionary... initial load should never attempt to get the ITextBuffer, because
            // it will recurse forever.
            var dictionaryProject = WpfTextViewHelpers.GetContainingProject(DictionaryFilePath);
            if (project == dictionaryProject)
                LoadXmlDictionary(DictionaryFilePath);
        }
Exemplo n.º 37
0
        private void Create(
            IEditorOperations editorOpts = null,
            ITextSearchService searchService = null,
            ITextStructureNavigator baseNav = null,
            params string[] lines)
        {
            _host = new Mock<IVimHost>(MockBehavior.Strict);
            if (editorOpts == null)
            {
                var tuple = EditorUtil.CreateViewAndOperations(lines);
                _view = tuple.Item1;
                editorOpts = tuple.Item2;
            }
            else
            {
                _view = EditorUtil.CreateView(lines);
            }

            searchService = searchService ?? EditorUtil.FactoryService.textSearchService;
            baseNav = baseNav ?? (new Mock<ITextStructureNavigator>(MockBehavior.Strict)).Object;
            var nav = TssUtil.CreateTextStructureNavigator(WordKind.NormalWord, baseNav);
            _globalSettings = MockObjectFactory.CreateGlobalSettings(ignoreCase: true);
            _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object);
            _jumpList = new Mock<IJumpList>(MockBehavior.Strict);
            _search = new Mock<IIncrementalSearch>(MockBehavior.Strict);
            _operationsRaw = new DefaultOperations(_view, editorOpts, _host.Object, _settings.Object, nav, searchService, _jumpList.Object, _search.Object);
            _operations = _operationsRaw;
        }
		IncrementalSearchFactoryService(ITextSearchService textSearchService, IEditorOperationsFactoryService editorOperationsFactoryService) {
			this.textSearchService = textSearchService;
			this.editorOperationsFactoryService = editorOperationsFactoryService;
		}
Exemplo n.º 39
0
 public virtual void SetupBase()
 {
     _compositionContainer = GetOrCreateCompositionContainer();
     _textBufferFactoryService = _compositionContainer.GetExportedValue<ITextBufferFactoryService>();
     _textEditorFactoryService = _compositionContainer.GetExportedValue<ITextEditorFactoryService>();
     _smartIndentationService = _compositionContainer.GetExportedValue<ISmartIndentationService>();
     _editorOperationsFactoryService = _compositionContainer.GetExportedValue<IEditorOperationsFactoryService>();
     _editorOptionsFactoryService = _compositionContainer.GetExportedValue<IEditorOptionsFactoryService>();
     _textSearchService = _compositionContainer.GetExportedValue<ITextSearchService>();
     _outliningManagerService = _compositionContainer.GetExportedValue<IOutliningManagerService>();
     _textBufferUndoManagerProvider = _compositionContainer.GetExportedValue<ITextBufferUndoManagerProvider>();
     _contentTypeRegistryService = _compositionContainer.GetExportedValue<IContentTypeRegistryService>();
     _adhocOutlinerFactory = _compositionContainer.GetExportedValue<IAdhocOutlinerFactory>();
     _taggerFactory = _compositionContainer.GetExportedValue<ITaggerFactory>();
 }