Пример #1
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView textView = EditorAdaptersFactory.GetWpfTextView(textViewAdapter);

            if (textView == null)
            {
                return;
            }
            ITextStructureNavigator navigator = TextStructureNavigatorSelector.GetTextStructureNavigator(textView.TextBuffer);

            AddCommandFilter(textViewAdapter, new MyCommandFilter(textView, navigator, ServiceProvider));
        }
Пример #2
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView wpfTextView = EditorAdaptersFactory.GetWpfTextView(textViewAdapter);

            wpfTextView.Options.OptionChanged += OnOptionsChanged;
            if (wpfTextView.Roles.Contains("PRIMARYDOCUMENT"))
            {
                CommandRouter commandRouter = CommandRouterProvider.GetCommandRouter(wpfTextView);
                commandRouter.AddCommandTarget(new EmacsCommandsFilter(wpfTextView, Manager, commandRouter));
                commandRouter.AddCommandTarget(Manager.GetOrCreateMarkSession(wpfTextView));
                commandRouter.AddCommandTarget(Manager.GetOrCreateUniversalArgumentSession(wpfTextView));
                commandRouter.AddCommandTarget(Manager.GetOrCreateKillClipboardSession(wpfTextView));
            }
            else
            {
                var workAroundFilter = new InteractiveRoleWorkAroundFilter(wpfTextView, Manager);
                IOleCommandTarget ppNextCmdTarg;
                textViewAdapter.AddCommandFilter(workAroundFilter, out ppNextCmdTarg);
                workAroundFilter.NextCommandTarget = ppNextCmdTarg;
            }
        }