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))); }
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); }
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)); }
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)))); }
public GoToDefKeyProcessor(CtrlKeyState state) { _state = state; }
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); }
public KeyProcessor GetAssociatedProcessor(IWpfTextView view) { return(view.Properties.GetOrCreateSingletonProperty(typeof(GoToDefKeyProcessor), () => new GoToDefKeyProcessor(CtrlKeyState.GetStateForView(view)))); }