Getting an API for when the user clicks on a segment

With the Integration APIs is should be possible to add functionalities on clicked segment using the Editor Controller. However the coding examples I tried all result in build errors. Here is a sample of a code that was added in a new class and the error:

    [AutoSuggestProvider(Id="SourceCopyAutoSuggestProvider", Name="AutoSuggest provider for copying the source words")]
    public class AutoSuggests : AbstractAutoSuggestProvider
    {

        protected override void OnActiveSegmentChanged()
        {
            //base.OnActiveSegmentChanged();
            System.Diagnostics.Debug.WriteLine("On active {}", ActiveSegmentPair != null);
        }
    }

Erros:

 'Sdl.Sdk.FileTypeSupport.Samples.Bil.AutoSuggests' does not implement inherited abstract member 'Sdl.TranslationStudioAutomation.IntegrationApi.AutoSuggest.AbstractAutoSuggestProvider.GetSuggestions(Sdl.TranslationStudioAutomation.IntegrationApi.AutoSuggest.AbstractEditingContext)'   

I get many similar errors when I try to use the Integration Framework.

What is the correct way to use the Editor Controller and the event on clicking on a segment?

Parents
  • Hello,

    Some of API classes are defined as abstract. When you implement the class derived from abstract classs, you have to implement all the abstract methods of the abstract class. For class AbstractAutoSuggestProvider, looking up the documentation or directly browse the class AbstractAutoSuggestProvider in object browser from Visual Studio, you may find the signature of the function of GetSuggestions:

    protected abstract IEnumerable<AbstractAutoSuggestResult> GetSuggestions(AbstractEditingContext context)

    The function is marked as abstract. Therefore you need implement this function so that Studio could retrieve your suggestions to display.

Reply
  • Hello,

    Some of API classes are defined as abstract. When you implement the class derived from abstract classs, you have to implement all the abstract methods of the abstract class. For class AbstractAutoSuggestProvider, looking up the documentation or directly browse the class AbstractAutoSuggestProvider in object browser from Visual Studio, you may find the signature of the function of GetSuggestions:

    protected abstract IEnumerable<AbstractAutoSuggestResult> GetSuggestions(AbstractEditingContext context)

    The function is marked as abstract. Therefore you need implement this function so that Studio could retrieve your suggestions to display.

Children
No Data