I wanted to tweak TextMatchFilter to match all given strings, instead of any. Had to copy its code, instead of inheriting it, because MatchingStrategies property is private. So I copied the code, changed it, and my new filtering works.
But I lost text highlighting. Looking through code I found that HighlightTextRenderer has Filter property of type TextMatchFilter. I propose that this property should be of some interface type that any filter could implement, including TextMatchFilter.
I guess I can make a custom renderer, and I probably will using copy/paste/tweak strategy as before, but it feels like I shouldn't have to.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the modification! That helped me as well.
I noticed that you also need to change the implementation of HighlightTextRenderer.RegisterNewFilter to use ITextMatchFilter instead of TextMatchFilter. Otherwise an object implementing ITextMatchFilter will never be installed in HighlightTextRenderer.
For me the following code works:
I wanted to tweak TextMatchFilter to match all given strings, instead of any. Had to copy its code, instead of inheriting it, because MatchingStrategies property is private. So I copied the code, changed it, and my new filtering works.
But I lost text highlighting. Looking through code I found that HighlightTextRenderer has Filter property of type TextMatchFilter. I propose that this property should be of some interface type that any filter could implement, including TextMatchFilter.
I guess I can make a custom renderer, and I probably will using copy/paste/tweak strategy as before, but it feels like I shouldn't have to.
I have added an
ITextMatchFilterso your re-implementation will operate.I've made
MatchingStrategiesprotected so you can access it in subclasses.I've also made the various strategies public so you can subclass them as you wish.
All these changes have been checked into the SF repo.
Thanks for the modification! That helped me as well.
I noticed that you also need to change the implementation of HighlightTextRenderer.RegisterNewFilter to use ITextMatchFilter instead of TextMatchFilter. Otherwise an object implementing ITextMatchFilter will never be installed in HighlightTextRenderer.
For me the following code works:
Last edit: Ulrich Bayer 2018-06-05