Exemple #1
0
 public CommandRouter GetCommandRouter(ITextView view)
 {
     return(view.Properties.GetOrCreateSingletonProperty(() =>
     {
         var ppNextCmdTarg = (IOleCommandTarget)null;
         IVsTextView viewAdapter = EditorAdapterFactoryService.GetViewAdapter(view);
         var service = ServiceProvider.GetService <DTE>();
         var commandRouter = new CommandRouter(view, viewAdapter as IOleCommandTarget, CompletionBroker, service);
         Marshal.ThrowExceptionForHR(viewAdapter.AddCommandFilter(commandRouter, out ppNextCmdTarg));
         commandRouter.Next = ppNextCmdTarg;
         return commandRouter;
     }));
 }
Exemple #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;
            }
        }
Exemple #3
0
 public EmacsCommandsFilter(ITextView view, EmacsCommandsManager manager, CommandRouter router)
 {
     this.view    = view;
     this.manager = manager;
     this.router  = router;
 }