The state of the control key for a given view, which is kept up-to-date by a combination of the key processor and the mouse process
Esempio n. 1
0
        public IMouseProcessor GetAssociatedProcessor(IWpfTextView view)
        {
            var buffer = view.TextBuffer;

            IOleCommandTarget shellCommandDispatcher = GetShellCommandDispatcher(view);

            if (shellCommandDispatcher == null)
            {
                return(null);
            }

            ITelemetrySession   telemetrySession = TelemetrySessionForPPT.Create(typeof(GoToDefMouseHandler).Assembly);
            IVsExtensionManager manager          = _globalServiceProvider.GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;

            if (manager == null)
            {
                return(null);
            }

            IInstalledExtension extension;

            manager.TryGetInstalledExtension("GoToDef", out extension);
            if (extension != null)
            {
                return(null);
            }

            return(new GoToDefMouseHandler(view,
                                           shellCommandDispatcher,
                                           telemetrySession,
                                           _aggregatorFactory.GetClassifier(buffer),
                                           _navigatorService.GetTextStructureNavigator(buffer),
                                           CtrlKeyState.GetStateForView(view)));
        }
Esempio n. 2
0
        public GoToDefMouseHandler(IWpfTextView view, IOleCommandTarget commandTarget, ITelemetrySession telemetrySession,
                                   IClassifier aggregator, ITextStructureNavigator navigator, CtrlKeyState state)
        {
            _view             = view;
            _commandTarget    = commandTarget;
            _telemetrySession = telemetrySession;
            _state            = state;
            _aggregator       = aggregator;
            _navigator        = navigator;

            _state.CtrlKeyStateChanged += (sender, args) =>
            {
                if (_state.Enabled)
                {
                    this.TryHighlightItemUnderMouse(RelativeToView(Mouse.PrimaryDevice.GetPosition(_view.VisualElement)));
                }
                else
                {
                    this.SetHighlightSpan(null);
                }
            };

            // Some other points to clear the highlight span.
            _view.LostAggregateFocus       += (sender, args) => this.SetHighlightSpan(null);
            _view.VisualElement.MouseLeave += (sender, args) => this.SetHighlightSpan(null);
        }
Esempio n. 3
0
        public IMouseProcessor GetAssociatedProcessor(IWpfTextView view)
        {
            var buffer = view.TextBuffer;

            IOleCommandTarget shellCommandDispatcher = GetShellCommandDispatcher(view);

            if (shellCommandDispatcher == null)
                return null;

            return new GoToDefMouseHandler(view,
                                           shellCommandDispatcher,
                                           AggregatorFactory.GetClassifier(buffer),
                                           NavigatorService.GetTextStructureNavigator(buffer),
                                           CtrlKeyState.GetStateForView(view));
        }
Esempio n. 4
0
        public KeyProcessor GetAssociatedProcessor(IWpfTextView view)
        {
            IVsExtensionManager manager = _serviceProvider.GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;

            if (manager == null)
            {
                return(null);
            }

            IInstalledExtension extension;

            manager.TryGetInstalledExtension("GoToDef", out extension);
            if (extension != null)
            {
                return(null);
            }

            return(view.Properties.GetOrCreateSingletonProperty(typeof(GoToDefKeyProcessor),
                                                                () => new GoToDefKeyProcessor(CtrlKeyState.GetStateForView(view))));
        }
Esempio n. 5
0
 public GoToDefKeyProcessor(CtrlKeyState state)
 {
     _state = state;
 }
Esempio n. 6
0
 public GoToDefKeyProcessor(CtrlKeyState state)
 {
     _state = state;
 }
Esempio n. 7
0
        public GoToDefMouseHandler(IWpfTextView view, IOleCommandTarget commandTarget, IClassifier aggregator,
                                   ITextStructureNavigator navigator, CtrlKeyState state)
        {
            _view = view;
            _commandTarget = commandTarget;
            _state = state;
            _aggregator = aggregator;
            _navigator = navigator;

            _state.CtrlKeyStateChanged += (sender, args) =>
            {
                if (_state.Enabled)
                    this.TryHighlightItemUnderMouse(RelativeToView(Mouse.PrimaryDevice.GetPosition(_view.VisualElement)));
                else
                    this.SetHighlightSpan(null);
            };

            // Some other points to clear the highlight span:

            _view.LostAggregateFocus += (sender, args) => this.SetHighlightSpan(null);
            _view.VisualElement.MouseLeave += (sender, args) => this.SetHighlightSpan(null);
        }
Esempio n. 8
0
 public KeyProcessor GetAssociatedProcessor(IWpfTextView view)
 {
     return(view.Properties.GetOrCreateSingletonProperty(typeof(GoToDefKeyProcessor),
                                                         () => new GoToDefKeyProcessor(CtrlKeyState.GetStateForView(view))));
 }