private AlloyEditorNavigationSourceWalker(ITreeNodeStream input, ITextSnapshot snapshot, ReadOnlyCollection <IToken> tokens, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService, IGlyphService glyphService, IOutputWindowService outputWindowService) : base(input, snapshot, outputWindowService) { Contract.Requires <ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService"); Contract.Requires <ArgumentNullException>(glyphService != null, "glyphService"); _tokens = tokens; _editorNavigationTypeRegistryService = editorNavigationTypeRegistryService; _glyphService = glyphService; }
private AlloyEditorNavigationSourceWalker(ITreeNodeStream input, ITextSnapshot snapshot, ReadOnlyCollection<IToken> tokens, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService, IGlyphService glyphService, IOutputWindowService outputWindowService) : base(input, snapshot, outputWindowService) { Contract.Requires<ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService"); Contract.Requires<ArgumentNullException>(glyphService != null, "glyphService"); _tokens = tokens; _editorNavigationTypeRegistryService = editorNavigationTypeRegistryService; _glyphService = glyphService; }
private AlloyEditorNavigationSourceWalker(ITreeNodeStream input, ITextSnapshot snapshot, ReadOnlyCollection <IToken> tokens, [NotNull] IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService, [NotNull] IGlyphService glyphService, IOutputWindowService outputWindowService) : base(input, snapshot, outputWindowService) { Requires.NotNull(editorNavigationTypeRegistryService, nameof(editorNavigationTypeRegistryService)); Requires.NotNull(glyphService, nameof(glyphService)); _tokens = tokens; _editorNavigationTypeRegistryService = editorNavigationTypeRegistryService; _glyphService = glyphService; }
public AntlrEditorNavigationSource(ITextBuffer textBuffer, AntlrBackgroundParser backgroundParser, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService) { Contract.Requires<ArgumentNullException>(textBuffer != null, "textBuffer"); Contract.Requires<ArgumentNullException>(backgroundParser != null, "backgroundParser"); Contract.Requires<ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService"); this.TextBuffer = textBuffer; this.BackgroundParser = backgroundParser; this.EditorNavigationTypeRegistryService = editorNavigationTypeRegistryService; this._parserRuleNavigationType = this.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.ParserRule); this._lexerRuleNavigationType = this.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.LexerRule); string assemblyName = typeof(AntlrEditorNavigationSource).Assembly.GetName().Name; this._lexerRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/lexericon.png", assemblyName))); this._parserRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/parsericon.png", assemblyName))); this.BackgroundParser.ParseComplete += HandleBackgroundParseComplete; this.BackgroundParser.RequestParse(false); }
public AntlrEditorNavigationSource([NotNull] ITextBuffer textBuffer, [NotNull] AntlrBackgroundParser backgroundParser, [NotNull] IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService) { Requires.NotNull(textBuffer, nameof(textBuffer)); Requires.NotNull(backgroundParser, nameof(backgroundParser)); Requires.NotNull(editorNavigationTypeRegistryService, nameof(editorNavigationTypeRegistryService)); this.TextBuffer = textBuffer; this.BackgroundParser = backgroundParser; this.EditorNavigationTypeRegistryService = editorNavigationTypeRegistryService; this._parserRuleNavigationType = this.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.ParserRule); this._lexerRuleNavigationType = this.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.LexerRule); string assemblyName = typeof(AntlrEditorNavigationSource).Assembly.GetName().Name; this._lexerRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/lexericon.png", assemblyName))); this._parserRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/parsericon.png", assemblyName))); this.BackgroundParser.ParseComplete += HandleBackgroundParseComplete; this.BackgroundParser.RequestParse(false); }
public EditorNavigationMargin(IWpfTextView wpfTextView, IEnumerable<IEditorNavigationSource> sources, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService) { Contract.Requires<ArgumentNullException>(wpfTextView != null, "wpfTextView"); Contract.Requires<ArgumentNullException>(sources != null, "sources"); Contract.Requires<ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService"); this._wpfTextView = wpfTextView; this._sources = sources; this._editorNavigationTypeRegistryService = editorNavigationTypeRegistryService; _navigationControls = this._sources .SelectMany(source => source.GetNavigationTypes()) .Distinct() //.OrderBy(...) .Select(type => Tuple.Create(type, default(EditorNavigationComboBox))) .ToArray(); if (this._navigationControls.Length == 0) { this._container = new UniformGrid() { Visibility = Visibility.Collapsed }; return; } this._container = new UniformGrid() { Columns = _navigationControls.Length, Rows = 1 }; _navigationControls = Array.ConvertAll(_navigationControls, pair => { EditorNavigationComboBox comboBox = new EditorNavigationComboBox() { Cursor = Cursors.Arrow, ToolTip = new ToolTip() { Content = pair.Item1.Definition.DisplayName } }; comboBox.DropDownOpened += OnDropDownOpened; comboBox.SelectionChanged += OnSelectionChanged; return Tuple.Create(pair.Item1, comboBox); }); foreach (var controlPair in _navigationControls) { this._container.Children.Add(controlPair.Item2); } this._wpfTextView.Caret.PositionChanged += OnCaretPositionChanged; foreach (var source in this._sources) { source.NavigationTargetsChanged += WeakEvents.AsWeak(OnNavigationTargetsChanged, eh => source.NavigationTargetsChanged -= eh); UpdateNavigationTargets(source); } }
public EditorNavigationMargin([NotNull] IWpfTextView wpfTextView, [NotNull] IEnumerable <IEditorNavigationSource> sources, [NotNull] IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService) { Requires.NotNull(wpfTextView, nameof(wpfTextView)); Requires.NotNull(sources, nameof(sources)); Requires.NotNull(editorNavigationTypeRegistryService, nameof(editorNavigationTypeRegistryService)); this._wpfTextView = wpfTextView; this._sources = sources; this._editorNavigationTypeRegistryService = editorNavigationTypeRegistryService; _navigationControls = this._sources .SelectMany(source => source.GetNavigationTypes()) .Distinct() //.OrderBy(...) .Select(type => Tuple.Create(type, default(EditorNavigationComboBox))) .ToArray(); if (this._navigationControls.Length == 0) { this._container = new UniformGrid() { Visibility = Visibility.Collapsed }; return; } this._container = new UniformGrid() { Columns = _navigationControls.Length, Rows = 1 }; _navigationControls = Array.ConvertAll(_navigationControls, pair => { EditorNavigationComboBox comboBox = new EditorNavigationComboBox() { Cursor = Cursors.Arrow, ToolTip = new ToolTip() { Content = pair.Item1.Definition.DisplayName } }; comboBox.DropDownOpened += OnDropDownOpened; comboBox.SelectionChanged += OnSelectionChanged; return(Tuple.Create(pair.Item1, comboBox)); }); foreach (var controlPair in _navigationControls) { this._container.Children.Add(controlPair.Item2); } this._wpfTextView.Caret.PositionChanged += OnCaretPositionChanged; foreach (var source in this._sources) { source.NavigationTargetsChanged += WeakEvents.AsWeak(OnNavigationTargetsChanged, eh => source.NavigationTargetsChanged -= eh); UpdateNavigationTargets(source); } }
public Antlr4EditorNavigationSourceProvider(IBackgroundParserFactoryService backgroundParserFactoryService, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService) { _backgroundParserFactoryService = backgroundParserFactoryService; _editorNavigationTypeRegistryService = editorNavigationTypeRegistryService; }
public AntlrEditorNavigationSource(ITextBuffer textBuffer, AntlrBackgroundParser backgroundParser, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService) { Contract.Requires <ArgumentNullException>(textBuffer != null, "textBuffer"); Contract.Requires <ArgumentNullException>(backgroundParser != null, "backgroundParser"); Contract.Requires <ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService"); this.TextBuffer = textBuffer; this.BackgroundParser = backgroundParser; this.EditorNavigationTypeRegistryService = editorNavigationTypeRegistryService; this._parserRuleNavigationType = this.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.ParserRule); this._lexerRuleNavigationType = this.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.LexerRule); string assemblyName = typeof(AntlrEditorNavigationSource).Assembly.GetName().Name; this._lexerRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/lexericon.png", assemblyName))); this._parserRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/parsericon.png", assemblyName))); this.BackgroundParser.ParseComplete += HandleBackgroundParseComplete; this.BackgroundParser.RequestParse(false); }
public EditorNavigationDropdownBar(IVsCodeWindow codeWindow, IVsEditorAdaptersFactoryService editorAdaptersFactory, IEnumerable <IEditorNavigationSource> sources, IBufferGraphFactoryService bufferGraphFactoryService, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService) { Contract.Requires <ArgumentNullException>(codeWindow != null, "codeWindow"); Contract.Requires <ArgumentNullException>(editorAdaptersFactory != null, "editorAdaptersFactory"); Contract.Requires <ArgumentNullException>(sources != null, "sources"); Contract.Requires <ArgumentNullException>(bufferGraphFactoryService != null, "bufferGraphFactoryService"); Contract.Requires <ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService"); this._codeWindow = codeWindow; this._editorAdaptersFactory = editorAdaptersFactory; this._sources = sources; this._bufferGraphFactoryService = bufferGraphFactoryService; this._editorNavigationTypeRegistryService = editorNavigationTypeRegistryService; this._currentTextView = editorAdaptersFactory.GetWpfTextView(codeWindow.GetLastActiveView()); this._dispatcher = this._currentTextView.VisualElement.Dispatcher; this._imageList = new ImageList() { ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit }; _navigationControls = this._sources .SelectMany(source => source.GetNavigationTypes()) .Distinct() //.OrderBy(...) .Select(type => Tuple.Create(type, new List <IEditorNavigationTarget>())) .ToArray(); _selectedItem = new IEditorNavigationTarget[_navigationControls.Length]; if (this._navigationControls.Length == 0) { return; } IConnectionPointContainer connectionPointContainer = codeWindow as IConnectionPointContainer; if (connectionPointContainer != null) { Guid textViewEventsGuid = typeof(IVsCodeWindowEvents).GUID; IConnectionPoint connectionPoint; connectionPointContainer.FindConnectionPoint(ref textViewEventsGuid, out connectionPoint); if (connectionPoint != null) { connectionPoint.Advise(this, out _codeWindowEventsCookie); } } IVsTextView primaryView = codeWindow.GetPrimaryView(); if (primaryView != null) { ((IVsCodeWindowEvents)this).OnNewView(primaryView); } IVsTextView secondaryView = codeWindow.GetSecondaryView(); if (secondaryView != null) { ((IVsCodeWindowEvents)this).OnNewView(secondaryView); } foreach (var source in this._sources) { source.NavigationTargetsChanged += WeakEvents.AsWeak(OnNavigationTargetsChanged, eh => source.NavigationTargetsChanged -= eh); UpdateNavigationTargets(source); } _currentTextView.Caret.PositionChanged += OnCaretPositionChanged; }
public EditorNavigationDropdownBar(IVsCodeWindow codeWindow, IVsEditorAdaptersFactoryService editorAdaptersFactory, IEnumerable<IEditorNavigationSource> sources, IBufferGraphFactoryService bufferGraphFactoryService, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService) { Contract.Requires<ArgumentNullException>(codeWindow != null, "codeWindow"); Contract.Requires<ArgumentNullException>(editorAdaptersFactory != null, "editorAdaptersFactory"); Contract.Requires<ArgumentNullException>(sources != null, "sources"); Contract.Requires<ArgumentNullException>(bufferGraphFactoryService != null, "bufferGraphFactoryService"); Contract.Requires<ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService"); this._codeWindow = codeWindow; this._editorAdaptersFactory = editorAdaptersFactory; this._sources = sources; this._bufferGraphFactoryService = bufferGraphFactoryService; this._editorNavigationTypeRegistryService = editorNavigationTypeRegistryService; this._currentTextView = editorAdaptersFactory.GetWpfTextView(codeWindow.GetLastActiveView()); this._dispatcher = this._currentTextView.VisualElement.Dispatcher; this._imageList = new ImageList() { ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit }; _navigationControls = this._sources .SelectMany(source => source.GetNavigationTypes()) .Distinct() //.OrderBy(...) .Select(type => Tuple.Create(type, new List<IEditorNavigationTarget>())) .ToArray(); _selectedItem = new IEditorNavigationTarget[_navigationControls.Length]; if (this._navigationControls.Length == 0) { return; } IConnectionPointContainer connectionPointContainer = codeWindow as IConnectionPointContainer; if (connectionPointContainer != null) { Guid textViewEventsGuid = typeof(IVsCodeWindowEvents).GUID; IConnectionPoint connectionPoint; connectionPointContainer.FindConnectionPoint(ref textViewEventsGuid, out connectionPoint); if (connectionPoint != null) connectionPoint.Advise(this, out _codeWindowEventsCookie); } IVsTextView primaryView = codeWindow.GetPrimaryView(); if (primaryView != null) ((IVsCodeWindowEvents)this).OnNewView(primaryView); IVsTextView secondaryView = codeWindow.GetSecondaryView(); if (secondaryView != null) ((IVsCodeWindowEvents)this).OnNewView(secondaryView); foreach (var source in this._sources) { source.NavigationTargetsChanged += WeakEvents.AsWeak(OnNavigationTargetsChanged, eh => source.NavigationTargetsChanged -= eh); UpdateNavigationTargets(source); } _currentTextView.Caret.PositionChanged += OnCaretPositionChanged; }