protected override void OnActiveDocumentChanged()
 {
     if (_viewPartController == null)
     {
         _viewPartController =
             SdlTradosStudio.Application.GetController <RegexMatchAutoSuggestProviderViewPartController>();
     }
     if (_viewPartController != null)
     {
         if (_regexPatternEntries == null)
         {
             _regexPatternEntries = _viewPartController.RegexPatternEntries;
         }
         if (_variables == null)
         {
             _variables = _viewPartController.Variables;
         }
         if (_listChangeNotifier == null)
         {
             _listChangeNotifier          = _viewPartController.ListChangeNotifier;
             _listChangeNotifier.Changed += _listChangeNotifier_Changed;
         }
         InitializeCandidates();
     }
 }
        public RegexMatchAutoSuggestProvider()
        {
            _viewPartController =
                SdlTradosStudio.Application.GetController <RegexMatchAutoSuggestProviderViewPartController>();
            if (_viewPartController != null)
            {
                _regexPatternEntries = _viewPartController.RegexPatternEntries;
                _variables           = _viewPartController.Variables;

                _listChangeNotifier          = _viewPartController.ListChangeNotifier;
                _listChangeNotifier.Changed += _listChangeNotifier_Changed;
            }
        }