How to Invoke Native Find/Replace with Highlighting and Reset Display Filter Actions from Plugin Code?

Hello RWS Developer Community,

My name is Sameh Ragab, and I'm the developer of the TWAS Studio Assistant plugin (available on RWS AppStore). I'm reaching out to get guidance on implementing native Trados Studio behaviors within my plugin's Find/Replace and Display Filter functionality.

Background

My plugin includes a Regex Manager with Find/Replace and Display Filter features. While I can successfully navigate to segments and apply custom display filters using the public API, I'm unable to replicate certain native Studio behaviors that would significantly improve user experience.

Specific Technical Questions

1. Find Next with Native Text Highlighting

  • Current Implementation: I use EditorController.ActiveDocument.SetActiveSegmentPair(paragraphUnitId, segmentId, true) to navigate to matching segments, but the matched text is not highlighted like it is when using Studio's native Find (Ctrl+F → F4).
  • Question: Is there an Action class or API method I can invoke to trigger Studio's native Find Next functionality with text highlighting? I've tried SendKeys with F4, but this feels like a workaround rather than a proper integration.
  • Desired Behavior: When my plugin finds a match (plain text or regex), the matching text should be highlighted in orange, just like Studio's native Find dialog.

2. Reset Display Filter Action

  • Current Implementation: I call ActiveDocument.ApplyFilterOnSegments(null) to clear filters programmatically, and use SendKeys.SendWait("^%{F6}") to invoke the native Reset Filters command.
  • Question: Is there an Action class (similar to how Studio uses ExecuteAction<TAction>()) for the Reset Display Filter command? What's the proper way to invoke this natively without relying on SendKeys?
  • Desired Behavior: A single API call that performs the complete filter reset, just like Ctrl+Alt+F6.

3. Access to Advanced Display Filter Implementation

  • Observation: The Studio's Advanced Display Filter is very powerful, but I couldn't find its source code in the Sdl-Community GitHub repository.
  • Question: Is the Advanced Display Filter implementation available publicly? If so, where can I find it? Understanding how Studio implements this feature would help me better integrate my custom IDisplayFilter implementation.

4. General Editor Integration Guidance

  • Question: Is there documentation or sample code demonstrating how plugins can invoke Studio's native editor commands/actions programmatically? Specifically:
    • Find/Replace operations with highlighting
    • Filter management (apply, clear, reset)
    • Search scope configuration (source/target, case-sensitive, regex mode)

What I've Already Tried

  • White check mark Successfully implemented IDisplayFilter for custom segment filtering
  • White check mark Using EditorController and ActiveDocument API for segment navigation
  • White check mark Reviewed the Sdl-Community repository for similar implementations
  • White check mark Studied the Studio API Documentation
  • X Unable to find Action classes or command IDs for Find Next and Reset Filters
  • X No examples of native Find/Replace invocation with highlighting in public plugins

Development Environment

  • Language: C# (.NET Framework 4.8)
  • Target: Trados Studio 2024 (Studio 18)
  • Referenced Assemblies:
    • Sdl.TranslationStudioAutomation.IntegrationApi
    • Sdl.FileTypeSupport.Framework.BilingualApi
    • Sdl.Desktop.IntegrationApi

Request

If anyone from the RWS development team or experienced plugin developers could point me to:

  1. The correct Action classes or API methods for native Find/Replace and Reset Filters
  2. Documentation on Studio's command/action system
  3. Source code references for Advanced Display Filter (if publicly available)
  4. Any code samples demonstrating proper editor command integration

I would be extremely grateful. My goal is to provide users with a seamless experience that feels native to Studio rather than relying on workarounds like SendKeys.

Thank you in advance for your help!

Best regards,
Sameh Ragab
Developer, TWAS Studio Assistant

Parents
  • Hi  , this is a quite lengthy question... let's see if I can help here.

    Native Find/Replace with Highlighting

    Current Situation: As you’ve found, there’s no public API that exposes the exact behavior of Studio’s native Find/Replace with orange highlighting inside a segment. There is a method bool FindTextInSegment(string segmentNumber, string text, bool highlightText, bool searchInSource) on IStudioDocument, but this does not fully replicate the Studio native experience or its highlighting logic.

    There isn’t an Action class or fully public method that lets plugin code programmatically trigger the internal highlighting seen when a user uses Find Next (Ctrl+F → F4). Relying on workarounds like SendKeys is not sustainable for long-term plugin development.

    The ideal way forward would be to expose this via a more flexible API. For example, extending IDisplayRowInfo with properties allowing developers to specify markup or a style for the text found during filtering. This would empower plugin developers to offer a seamless, native-feeling highlighting experience, especially when the text match comes from an applied filter criterion.

    Suggestion: I recommend logging this as an idea/enhancement in the RWS Ideas Portal, specifically requesting additional API exposure for either:

    1. A direct Find/Replace with Highlighting method,
    2. Or extensibility of segment markup/styling in IDisplayRowInfo for filter matches.

    I’ll then follow up internally with our development team and submit a New API proposal reflecting this need for more native find/highlighting support for plugins.

    Reset Display Filter Action

    Your call to ActiveDocument.ApplyFilterOnSegments(null) is already the main, public API-supported way to clear applied filters. Internally, Studio uses a command for this, but as of the latest public documentation, this is not directly exposed for plugins. No official ExecuteAction<TAction>() for reset filter is available.

    From Studio 2021 onward, the Advanced Display Filter is fully integrated and is no longer open source. Only the legacy code (up to Studio 2019) is available: https://github.com/RWS/Sdl-Community/tree/studio_2019/AdvancedDisplayFilter While this older version can’t show you latest internals, the fundamental patterns for creating and clearing display filters remain similar.

    The Public API documentation is your primary source (including display filter samples).

    Patrick Andrew Hartnett | Developer Experience | Team Lead | RWS Group

Reply
  • Hi  , this is a quite lengthy question... let's see if I can help here.

    Native Find/Replace with Highlighting

    Current Situation: As you’ve found, there’s no public API that exposes the exact behavior of Studio’s native Find/Replace with orange highlighting inside a segment. There is a method bool FindTextInSegment(string segmentNumber, string text, bool highlightText, bool searchInSource) on IStudioDocument, but this does not fully replicate the Studio native experience or its highlighting logic.

    There isn’t an Action class or fully public method that lets plugin code programmatically trigger the internal highlighting seen when a user uses Find Next (Ctrl+F → F4). Relying on workarounds like SendKeys is not sustainable for long-term plugin development.

    The ideal way forward would be to expose this via a more flexible API. For example, extending IDisplayRowInfo with properties allowing developers to specify markup or a style for the text found during filtering. This would empower plugin developers to offer a seamless, native-feeling highlighting experience, especially when the text match comes from an applied filter criterion.

    Suggestion: I recommend logging this as an idea/enhancement in the RWS Ideas Portal, specifically requesting additional API exposure for either:

    1. A direct Find/Replace with Highlighting method,
    2. Or extensibility of segment markup/styling in IDisplayRowInfo for filter matches.

    I’ll then follow up internally with our development team and submit a New API proposal reflecting this need for more native find/highlighting support for plugins.

    Reset Display Filter Action

    Your call to ActiveDocument.ApplyFilterOnSegments(null) is already the main, public API-supported way to clear applied filters. Internally, Studio uses a command for this, but as of the latest public documentation, this is not directly exposed for plugins. No official ExecuteAction<TAction>() for reset filter is available.

    From Studio 2021 onward, the Advanced Display Filter is fully integrated and is no longer open source. Only the legacy code (up to Studio 2019) is available: https://github.com/RWS/Sdl-Community/tree/studio_2019/AdvancedDisplayFilter While this older version can’t show you latest internals, the fundamental patterns for creating and clearing display filters remain similar.

    The Public API documentation is your primary source (including display filter samples).

    Patrick Andrew Hartnett | Developer Experience | Team Lead | RWS Group

Children
No Data