/// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.ViewFilter"]/*' /> public ViewFilter(CodeWindowManager mgr, IVsTextView view) { this.pvaChar = IntPtr.Zero; this.mgr = mgr; this.service = mgr.LanguageService; this.source = mgr.Source; this.commentSupported = this.service.Preferences.EnableCommenting; this.textView = view; NativeMethods.ThrowOnFailure(view.AddCommandFilter(this, out nextTarget)); this.textViewEvents = new NativeMethods.ConnectionPointCookie(view, this, typeof(IVsTextViewEvents)); }
/// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.Close"]/*' /> public virtual void Close() { Trace.WriteLine("ViewFilter::Close"); if (textViewEvents != null) { textViewEvents.Dispose(); textViewEvents = null; } if (textView == this.service.LastActiveTextView) this.service.OnActiveViewChanged(null); textView.RemoveCommandFilter(this); // do not care about HRESULT. if (textTipData != null) { textTipData.Close(textView); textTipData = null; } Dispose(); }
private void Disconnect() { if (this.connection != null) { this.connection.Dispose(); this.connection = null; } }
private void Connect() { if (this.connection == null && this.site != null) { IVsTextManager2 textMgr2 = this.site.GetService(typeof(SVsTextManager)) as IVsTextManager2; if (textMgr2 != null) { this.connection = new NativeMethods.ConnectionPointCookie(textMgr2, (IVsTextManagerEvents2)this, typeof(IVsTextManagerEvents2)); Marshal.ReleaseComObject(textMgr2); } } }
/// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.RegisterTextViewEventHandlers"]/*' /> public virtual void RegisterTextViewEventHandlers(IVsTextView view) { this.textViewEvents = new NativeMethods.ConnectionPointCookie(view, this, typeof(IVsTextViewEvents)); }
/// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.RegisterTextViewEventHandlers"]/*' /> public virtual void RegisterExpansionManagerEventHandlers(IVsExpansionManager emgr) { this.expansionEvents = new NativeMethods.ConnectionPointCookie(emgr, this, typeof(IVsExpansionEvents)); }