Source

Resharper Spell Checker / ReSpeller / Bulbs / AddToInternalDictionaryBulbItem.cs

using JetBrains.Application;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Daemon;
using JetBrains.ReSharper.Feature.Services.Bulbs;
using JetBrains.TextControl;
using ReSpeller.SpellEngine;

namespace ReSpeller.Bulbs
{
  internal class AddToInternalDictionaryBulbItem : IBulbItem
  {
    private readonly string myNewWord;

    public AddToInternalDictionaryBulbItem(string newWord)
    {
      myNewWord = newWord;
    }

    #region IBulbAction Members

    public void Execute(ISolution solution, ITextControl textControl)
    {
      var languageWordStorage = Shell.Instance.GetComponent<ISingleLanguageWordStorage>();
      languageWordStorage.AddWordToCustomDict(myNewWord);
      Daemon.GetInstance(solution).Invalidate();
    }

    public string Text
    {
      get { return string.Format("Add \'{0}\' to internal dictionary[debug]", myNewWord); }
    }

    #endregion
  }
}