internal FindReferencesFilter RegisterCommandFilter(IWpfTextView textView, bool showProgress) { var textViewAdapter = editorFactory.GetViewAdapter(textView); if (textViewAdapter == null) { return(null); } var generalOptions = Setting.getGeneralOptions(serviceProvider); if (generalOptions == null || !generalOptions.FindAllReferencesEnabled) { return(null); } ITextDocument doc; if (textDocumentFactoryService.TryGetTextDocument(textView.TextBuffer, out doc)) { Debug.Assert(doc != null, "Text document shouldn't be null."); var filter = new FindReferencesFilter(doc, textView, fsharpVsLanguageService, serviceProvider, projectFactory, showProgress, fileSystem); AddCommandFilter(textViewAdapter, filter); return(filter); } return(null); }
internal FindReferencesFilter RegisterCommandFilter(IWpfTextView textView, bool showProgress) { var textViewAdapter = _editorFactory.GetViewAdapter(textView); if (textViewAdapter == null) { return(null); } var generalOptions = Setting.getGeneralOptions(_serviceProvider); if (generalOptions == null || !generalOptions.FindAllReferencesEnabled) { return(null); } ITextDocument doc; if (_textDocumentFactoryService.TryGetTextDocument(textView.TextBuffer, out doc)) { var filter = new FindReferencesFilter(doc, textView, _fsharpVsLanguageService, _serviceProvider, _projectFactory, showProgress, _fileSystem); Utils.AddCommandFilter(textViewAdapter, filter); return(filter); } return(null); }
private static void AddCommandFilter(IVsTextView viewAdapter, FindReferencesFilter commandFilter) { if (!commandFilter.IsAdded) { // Get the view adapter from the editor factory IOleCommandTarget next; int hr = viewAdapter.AddCommandFilter(commandFilter, out next); if (hr == VSConstants.S_OK) { commandFilter.IsAdded = true; // You'll need the next target for Exec and QueryStatus if (next != null) commandFilter.NextTarget = next; } } }
internal FindReferencesFilter RegisterCommandFilter(IWpfTextView textView, bool showProgress) { var textViewAdapter = editorFactory.GetViewAdapter(textView); if (textViewAdapter == null) return null; var generalOptions = Setting.getGeneralOptions(serviceProvider); if (generalOptions == null || !generalOptions.FindAllReferencesEnabled) return null; ITextDocument doc; if (textDocumentFactoryService.TryGetTextDocument(textView.TextBuffer, out doc)) { var filter = new FindReferencesFilter(doc, textView, fsharpVsLanguageService, serviceProvider, projectFactory, showProgress, fileSystem); AddCommandFilter(textViewAdapter, filter); return filter; } return null; }
private static void AddCommandFilter(IVsTextView viewAdapter, FindReferencesFilter commandFilter) { if (!commandFilter.IsAdded) { // Get the view adapter from the editor factory IOleCommandTarget next; int hr = viewAdapter.AddCommandFilter(commandFilter, out next); if (hr == VSConstants.S_OK) { commandFilter.IsAdded = true; // You'll need the next target for Exec and QueryStatus if (next != null) { commandFilter.NextTarget = next; } } } }