/// <summary>
 /// This method is executed when action is selected in the context menu
 /// </summary>
 public void Invoke()
 {
     if (dictionary != null && Keyboard.Modifiers == ModifierKeys.Control)
     {
         dictionary.ReplaceAllOccurrences(span.GetText(span.TextBuffer.CurrentSnapshot), replaceWith);
     }
     else
     {
         span.TextBuffer.Replace(span.GetSpan(span.TextBuffer.CurrentSnapshot), replaceWith.Suggestion);
     }
 }
示例#2
0
        //=====================================================================

        /// <inheritdoc />
        public override void Invoke(CancellationToken cancellationToken)
        {
            if (dictionary != null && Keyboard.Modifiers == ModifierKeys.Control)
            {
                dictionary.ReplaceAllOccurrences(this.Span.GetText(this.Span.TextBuffer.CurrentSnapshot), replaceWith);
            }
            else
            {
                this.Span.TextBuffer.Replace(this.Span.GetSpan(this.Span.TextBuffer.CurrentSnapshot), replaceWith.Suggestion);
            }
        }
示例#3
0
        //=====================================================================

        /// <inheritdoc />
        public override void Invoke(CancellationToken cancellationToken)
        {
            var replacement = replaceWith;

            if (escapeApostrophes)
            {
                replacement = new SpellingSuggestion(replacement.Culture, replacement.Suggestion.Replace("'", "''"));
            }

            if (dictionary != null && Keyboard.Modifiers == ModifierKeys.Control)
            {
                dictionary.ReplaceAllOccurrences(this.Span.GetText(this.Span.TextBuffer.CurrentSnapshot), replacement);
            }
            else
            {
                this.Span.TextBuffer.Replace(this.Span.GetSpan(this.Span.TextBuffer.CurrentSnapshot), replacement.Suggestion);
            }
        }