public TextControlSite(IServiceProvider serviceProvider, ITextLanguage language) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } this._language = language; this._serviceProvider = serviceProvider; }
protected override void Dispose(bool disposing) { if (disposing) { this._textManager.UnregisterTextControl(this); this._textManager = null; this._textLanguage = null; this._textColorizer = null; this._textHost = null; this._buffer = null; } base.Dispose(disposing); }
private void SetTextLanguage(ITextLanguage language) { this._textLanguage = language; if (this._textHost != null) { this._textHost.Dispose(); this._textHost = null; } if (this._textColorizer != null) { this._textColorizer.Dispose(); this._textColorizer = null; } if (this._textLanguage != null) { this._textHost = this._textLanguage.GetTextControlHost(this, this.Site); this._textColorizer = this._textLanguage.GetColorizer(this.Site); } foreach (TextView view in this._views) { view.UpdateTextLanguage(); if (this._textHost != null) { this._textHost.OnTextViewCreated(view); } } }
public ColorInfoTable GetColorTable(ITextLanguage language) { if (language == null) { return this.DefaultColorTable; } ColorInfoTable table = (ColorInfoTable) _colorTables[language]; if (table == null) { ITextColorizer colorizer = language.GetColorizer(this._serviceProvider); ColorInfo[] infoArray = (colorizer != null) ? colorizer.ColorTable : null; table = new ColorInfoTable(0x40 + ((infoArray != null) ? infoArray.Length : 0)); this.FillColorTableWithStandardColors(table); if (infoArray != null) { for (int i = 0; i < infoArray.Length; i++) { table[i + 0x40] = infoArray[i]; } } _colorTables[language] = table; } return table; }