//===================================================================== /// <summary> /// Constructor /// </summary> /// <param name="textView">The text view to use</param> /// <param name="serviceProvider">The service provider to use</param> /// <param name="aggregator">The classifier tag aggregator to use</param> /// <param name="navigator">The text structure navigator to use</param> /// <param name="state">The Ctrl key state tracker to use</param> public GoToDefinitionMouseProcessor(IWpfTextView textView, SVsServiceProvider serviceProvider, IClassifier aggregator, ITextStructureNavigator navigator, CtrlKeyState state) { this.TextView = textView; this.ServiceProvider = serviceProvider; this.ctrlState = state; this.aggregator = aggregator; this.navigator = navigator; this.ctrlState.CtrlKeyStateChanged += (sender, args) => { if (this.ctrlState.Enabled) { this.TryHighlightItemUnderMouse(this.RelativeToView(Mouse.PrimaryDevice.GetPosition(this.TextView.VisualElement))); } else { this.SetHighlightSpan(null, null); } }; // Some other points to clear the highlight span: this.TextView.LostAggregateFocus += (sender, args) => this.SetHighlightSpan(null, null); this.TextView.VisualElement.MouseLeave += (sender, args) => this.SetHighlightSpan(null, null); }
/// <inheritdoc /> public IMouseProcessor GetAssociatedProcessor(IWpfTextView view) { var options = new MefProviderOptions(GlobalServiceProvider); if (!options.EnableGoToDefinition || !options.EnableCtrlClickGoToDefinition) { return(null); } var buffer = view.TextBuffer; return(new XmlGoToDefinitionMouseProcessor(view, GlobalServiceProvider, AggregatorFactory.GetClassifier(buffer), NavigatorService.GetTextStructureNavigator(buffer), CtrlKeyState.GetStateForView(view))); }
//===================================================================== /// <summary> /// Constructor /// </summary> /// <param name="textView">The text view to use</param> /// <param name="serviceProvider">The service provider to use</param> /// <param name="aggregator">The classifier tag aggregator to use</param> /// <param name="navigator">The text structure navigator to use</param> /// <param name="state">The Ctrl key state tracker to use</param> /// <param name="enableInCRef">True to enable in <c>cref</c> targets, false if not</param> public CSharpGoToDefinitionMouseProcessor(IWpfTextView textView, SVsServiceProvider serviceProvider, IClassifier aggregator, ITextStructureNavigator navigator, CtrlKeyState state, bool enableInCRef) : base(textView, serviceProvider, aggregator, navigator, state) { this.enableInCRef = enableInCRef; }
//===================================================================== /// <summary> /// Constructor /// </summary> /// <param name="state">The control key state tracker to use</param> public GoToDefinitionKeyProcessor(CtrlKeyState state) { this.state = state; }
public KeyProcessor GetAssociatedProcessor(IWpfTextView view) { var options = new MefProviderOptions(serviceProvider); if (!options.EnableGoToDefinition || !options.EnableCtrlClickGoToDefinition) { return(null); } return(view.Properties.GetOrCreateSingletonProperty(typeof(GoToDefinitionKeyProcessor), () => new GoToDefinitionKeyProcessor(CtrlKeyState.GetStateForView(view)))); }
//===================================================================== /// <inheritdoc /> public XmlGoToDefinitionMouseProcessor(IWpfTextView textView, SVsServiceProvider serviceProvider, IClassifier aggregator, ITextStructureNavigator navigator, CtrlKeyState state) : base(textView, serviceProvider, aggregator, navigator, state) { }
//===================================================================== /// <summary> /// Constructor /// </summary> /// <param name="textView">The text view to use</param> /// <param name="serviceProvider">The service provider to use</param> /// <param name="aggregator">The classifier tag aggregator to use</param> /// <param name="navigator">The text structure navigator to use</param> /// <param name="state">The Ctrl key state tracker to use</param> public GoToDefinitionMouseProcessor(IWpfTextView textView, SVsServiceProvider serviceProvider, IClassifier aggregator, ITextStructureNavigator navigator, CtrlKeyState state) { this.TextView = textView; this.ServiceProvider = serviceProvider; this.ctrlState = state; this.aggregator = aggregator; this.navigator = navigator; this.ctrlState.CtrlKeyStateChanged += (sender, args) => { if(this.ctrlState.Enabled) this.TryHighlightItemUnderMouse(this.RelativeToView(Mouse.PrimaryDevice.GetPosition(this.TextView.VisualElement))); else this.SetHighlightSpan(null, null); }; // Some other points to clear the highlight span: this.TextView.LostAggregateFocus += (sender, args) => this.SetHighlightSpan(null, null); this.TextView.VisualElement.MouseLeave += (sender, args) => this.SetHighlightSpan(null, null); }