private static void AddCommandFilter(IVsTextView viewAdapter, HighlightUsageFilter commandFilter) { if (!commandFilter.IsAdded) { // Get the view adapter from the editor factory IOleCommandTarget next; int hr = viewAdapter.AddCommandFilter(commandFilter, out next); if (hr == VSConstants.S_OK) { commandFilter.IsAdded = true; // You'll need the next target for Exec and QueryStatus if (next != null) commandFilter.NextTarget = next; } } }
private static void AddCommandFilter(IVsTextView viewAdapter, HighlightUsageFilter commandFilter) { if (!commandFilter.IsAdded) { // Get the view adapter from the editor factory IOleCommandTarget next; int hr = viewAdapter.AddCommandFilter(commandFilter, out next); if (hr == VSConstants.S_OK) { commandFilter.IsAdded = true; // You'll need the next target for Exec and QueryStatus if (next != null) { commandFilter.NextTarget = next; } } } }