Esempio n. 1
0
		private static void AddCommandFilter(IVsTextView viewAdapter, KeyFilter commandFilter)
		{
			if (commandFilter.Added) return;
			//get the view adapter from the editor factory
			IOleCommandTarget next;
			var hr = viewAdapter.AddCommandFilter(commandFilter, out next);

			if (hr != VSConstants.S_OK) return;
			commandFilter.Added = true;
			//you'll need the next target for Exec and QueryStatus
			if (next != null)
				commandFilter.NextTarget = next;
		}
Esempio n. 2
0
        private static void AddCommandFilter(IVsTextView viewAdapter, KeyFilter commandFilter)
        {
            if (commandFilter.Added)
            {
                return;
            }
            //get the view adapter from the editor factory
            var hr = viewAdapter.AddCommandFilter(commandFilter, out IOleCommandTarget next);

            if (hr != VSConstants.S_OK)
            {
                return;
            }
            commandFilter.Added = true;
            //you'll need the next target for Exec and QueryStatus
            if (next != null)
            {
                commandFilter.NextTarget = next;
            }
        }