Example #1
0
        public void VsTextViewCreated(Microsoft.VisualStudio.TextManager.Interop.IVsTextView textViewAdapter)
        {
            var view = this.EditorAdaptersFactory.GetWpfTextView(textViewAdapter);

            view.Options.OptionChanged += OnOptionsChanged;
            view.LostAggregateFocus    += OnLostAggregateFocus;

            IOleCommandTarget nextCommandTarget;

            if (view.Roles.Contains(PredefinedTextViewRoles.PrimaryDocument))
            {
                CommandRouter commandRouter = CommandRouterProvider.GetCommandRouter(view);

                // Register internal handlers with the command router

                // Register the filter to execute emacs commands
                commandRouter.AddCommandTarget(new EmacsCommandsFilter(view, this.Manager, commandRouter));

                // Register the mark session
                commandRouter.AddCommandTarget(this.Manager.GetOrCreateMarkSession(view));

                // Register the universal argument session
                commandRouter.AddCommandTarget(this.Manager.GetOrCreateUniversalArgumentSession(view));
            }
            else
            {
                // Register the filter to execute emacs commands
                var commandFilter = new InteractiveRoleWorkAroundFilter(view, this.Manager);
                textViewAdapter.AddCommandFilter(commandFilter, out nextCommandTarget);
                commandFilter.NextCommandTarget = nextCommandTarget;
            }
        }
Example #2
0
        public void VsTextViewCreated(Microsoft.VisualStudio.TextManager.Interop.IVsTextView textViewAdapter)
        {
            var view = this.EditorAdaptersFactory.GetWpfTextView(textViewAdapter);
            view.Options.OptionChanged += OnOptionsChanged;

            IOleCommandTarget nextCommandTarget;

            if (view.Roles.Contains(PredefinedTextViewRoles.PrimaryDocument))
            {
                CommandRouter commandRouter = CommandRouterProvider.GetCommandRouter(view);

                // Register internal handlers with the command router

                // Register the filter to execute emacs commands
                commandRouter.AddCommandTarget(new EmacsCommandsFilter(view, this.Manager, commandRouter));

                // Register the mark session
                commandRouter.AddCommandTarget(this.Manager.GetOrCreateMarkSession(view));

                // Register the universal argument session
                commandRouter.AddCommandTarget(this.Manager.GetOrCreateUniversalArgumentSession(view));
            }
            else
            {
                // Register the filter to execute emacs commands
                var commandFilter = new InteractiveRoleWorkAroundFilter(view, this.Manager);
                textViewAdapter.AddCommandFilter(commandFilter, out nextCommandTarget);
                commandFilter.NextCommandTarget = nextCommandTarget;
            }
        }