internal StandardCommandDispatcher RegisterCommandDispatcher(IWpfTextView wpfTextView)
        {
            var view = _adaptersFactory.GetViewAdapter(wpfTextView);

            if (view != null)
            {
                return(StandardCommandDispatcher.Register(view, wpfTextView, GetServices()));
            }
            return(null);
        }
        public static void Register(IVsTextView interopTextView, IWpfTextView textView, CodeFormattingServices services)
        {
            GeneralOptionsPage generalOptions = (GeneralOptionsPage)(Package.GetGlobalService(typeof(GeneralOptionsPage)));
            if (!generalOptions.FormattingEnabled) return;

            var dispatcher = new StandardCommandDispatcher();
            dispatcher._textView = textView;
            dispatcher._services = services;
            interopTextView.AddCommandFilter(dispatcher, out dispatcher._commandChain);
        }
 public void TextViewCreated(IWpfTextView wpfTextView)
 {
     System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
     {
         var view = _adaptersFactory.GetViewAdapter(wpfTextView);
         if (view != null)
         {
             StandardCommandDispatcher.Register(view, wpfTextView, GetServices());
         }
     }));
 }
        public static StandardCommandDispatcher Register(IVsTextView interopTextView, IWpfTextView textView, CodeFormattingServices services)
        {
            var generalOptions = Setting.getGeneralOptions(services.ServiceProvider);
            if (generalOptions == null || !generalOptions.FormattingEnabled) return null;

            var dispatcher = new StandardCommandDispatcher();
            dispatcher._textView = textView;
            dispatcher._services = services;
            interopTextView.AddCommandFilter(dispatcher, out dispatcher._commandChain);
            return dispatcher;
        }
        public static void Register(IVsTextView interopTextView, IWpfTextView textView, CodeFormattingServices services)
        {
            GeneralOptionsPage generalOptions = (GeneralOptionsPage)(Package.GetGlobalService(typeof(GeneralOptionsPage)));
            if (!generalOptions.FormattingEnabled)
            {
                logger.Log(LogType.Information, "Formatting feature is disabled in General option page.");
                return;
            }

            var dispatcher = new StandardCommandDispatcher();
            dispatcher._textView = textView;
            dispatcher._services = services;
            interopTextView.AddCommandFilter(dispatcher, out dispatcher._commandChain);
        }
        public static StandardCommandDispatcher Register(IVsTextView interopTextView, IWpfTextView textView, CodeFormattingServices services)
        {
            var generalOptions = Utils.GetGeneralOptionsPage(services.ServiceProvider);

            if (!generalOptions.FormattingEnabled)
            {
                return(null);
            }

            var dispatcher = new StandardCommandDispatcher();

            dispatcher._textView = textView;
            dispatcher._services = services;
            interopTextView.AddCommandFilter(dispatcher, out dispatcher._commandChain);
            return(dispatcher);
        }
Exemplo n.º 7
0
        public static void Register(IVsTextView interopTextView, IWpfTextView textView, Services services)
        {
            GeneralOptionsPage generalOptions = (GeneralOptionsPage)(Package.GetGlobalService(typeof(GeneralOptionsPage)));

            if (!generalOptions.FormattingEnabled)
            {
                Debug.WriteLine("[Formatting] The feature is disabled in General option page.");
                return;
            }

            var dispatcher = new StandardCommandDispatcher();

            dispatcher._textView = textView;
            dispatcher._services = services;
            interopTextView.AddCommandFilter(dispatcher, out dispatcher._commandChain);
        }