Exemple #1
0
        internal AdornmentManager(
            IThreadingContext threadingContext,
            IWpfTextView textView,
            IViewTagAggregatorFactoryService tagAggregatorFactoryService,
            IAsynchronousOperationListener asyncListener,
            string adornmentLayerName)
        {
            Contract.ThrowIfNull(threadingContext);
            Contract.ThrowIfNull(textView);
            Contract.ThrowIfNull(tagAggregatorFactoryService);
            Contract.ThrowIfNull(adornmentLayerName);
            Contract.ThrowIfNull(asyncListener);

            _threadingContext       = threadingContext;
            _textView               = textView;
            _adornmentLayer         = textView.GetAdornmentLayer(adornmentLayerName);
            textView.LayoutChanged += OnLayoutChanged;
            _asyncListener          = asyncListener;

            // If we are not on the UI thread, we are at race with Close, but we should be on UI thread
            Contract.ThrowIfFalse(textView.VisualElement.Dispatcher.CheckAccess());
            textView.Closed += OnTextViewClosed;

            _tagAggregator = tagAggregatorFactoryService.CreateTagAggregator <T>(textView);

            _tagAggregator.TagsChanged += OnTagsChanged;
        }
Exemple #2
0
 GlyphTextMarkerService(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, [ImportMany] IEnumerable <Lazy <IGlyphTextMarkerMouseProcessorProvider, IGlyphTextMarkerMouseProcessorProviderMetadata> > glyphTextMarkerMouseProcessorProviders)
 {
     ViewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
     EditorFormatMapService          = editorFormatMapService;
     glyphTextMarkers = new HashSet <IGlyphTextMarkerImpl>();
     GlyphTextMarkerMouseProcessorProviders = Orderer.Order(glyphTextMarkerMouseProcessorProviders).ToArray();
 }
 public LintQuickInfoProvider(
     [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
     IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
 {
     _serviceProvider = serviceProvider;
     _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
 }
 public NavigateToHighlightReferenceCommandHandler(
     IOutliningManagerService outliningManagerService,
     IViewTagAggregatorFactoryService tagAggregatorFactory)
 {
     _outliningManagerService = outliningManagerService ?? throw new ArgumentNullException(nameof(outliningManagerService));
     _tagAggregatorFactory    = tagAggregatorFactory ?? throw new ArgumentNullException(nameof(tagAggregatorFactory));
 }
 protected PreviousInlineCommentCommand(
     IGitHubServiceProvider serviceProvider,
     IViewTagAggregatorFactoryService tagAggregatorFactory,
     IInlineCommentPeekService peekService)
     : base(serviceProvider, tagAggregatorFactory, peekService, CommandSet, CommandId)
 {
 }
Exemple #6
0
 public LineSeparatorAdornmentManagerProvider(
     IThreadingContext threadingContext,
     IViewTagAggregatorFactoryService tagAggregatorFactoryService,
     IAsynchronousOperationListenerProvider listenerProvider)
     : base(threadingContext, tagAggregatorFactoryService, listenerProvider)
 {
 }
Exemple #7
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="DocumentMarkMargin" /> class for a given textView
        /// </summary>
        /// <param name="viewTagAggregatorFactoryService"></param>
        /// <param name="glyphFactoryProviders"></param>
        /// <param name="wpfTextViewHost"></param>
        /// <param name="sessionService"></param>
        /// <param name="settingsManager"></param>
        public DocumentMarkMargin(
            IViewTagAggregatorFactoryService viewTagAggregatorFactoryService,
            IEnumerable <Lazy <IGlyphFactoryProvider, IGlyphMetadata> > glyphFactoryProviders,
            IWpfTextViewHost wpfTextViewHost,
            ISessionService sessionService,
            ISettingsManager settingsManager)
        {
            _glyphFactoryProviders = glyphFactoryProviders;
            _wpfTextViewHost       = wpfTextViewHost;
            _sessionService        = sessionService;
            _settingsManager       = settingsManager;
            try {
                Assumes.Present(_sessionService);
                Assumes.Present(_settingsManager);
            }
            catch (Exception ex) {
                Log.Error(ex, nameof(DocumentMarkMargin));
            }
            _iconCanvas = new Canvas {
                Background = Brushes.Transparent
            };
            _tagAggregator = viewTagAggregatorFactoryService.CreateTagAggregator <IGlyphTag>(_wpfTextViewHost.TextView);

            Width        = DefaultMarginWidth;
            ClipToBounds = true;

            _glyphFactories = new Dictionary <Type, GlyphFactoryInfo>();
            _childCanvases  = Array.Empty <Canvas>();
            Background      = new SolidColorBrush(Colors.Transparent);
            _lineInfos      = new Dictionary <object, LineInfo>();

            TryInitialize();
        }
        public PlayMouseProcessor(IWpfTextViewHost wpfTextViewHost, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
        {
            _wpfTextViewHost = wpfTextViewHost;
            _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;

            _createTagAggregator = _viewTagAggregatorFactoryService.CreateTagAggregator <PlayGlyphTag>(_wpfTextViewHost.TextView);
        }
        public PlayMouseProcessor(IWpfTextViewHost wpfTextViewHost, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
        {
            _wpfTextViewHost = wpfTextViewHost;
            _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;

            _createTagAggregator = _viewTagAggregatorFactoryService.CreateTagAggregator<PlayGlyphTag>(_wpfTextViewHost.TextView);
        }
        public static GoToMouseProcessor GetMouseProcessorForView(IWpfTextView textView, 
                                                                  TextViewConnectionListener textViewConnectionListener,
                                                                  IViewTagAggregatorFactoryService viewTagAggregatorFactoryService,
                                                                  GoToLocationService goToLocationService) {

            return textView.Properties.GetOrCreateSingletonProperty(() => new GoToMouseProcessor(textView, textViewConnectionListener, viewTagAggregatorFactoryService, goToLocationService));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TextAdornment1"/> class.
        /// </summary>
        /// <param name="view">Text view to create the adornment for</param>
        public TextAdornment1(IWpfTextView view, /* ITextStructureNavigatorSelectorService navigatorService,*/ IViewTagAggregatorFactoryService tagAggregatorService)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }

            //this.navigatorService = navigatorService;

            this.layer = view.GetAdornmentLayer("TextAdornment1");

            this.view = view;
            //this.view.LayoutChanged += this.OnLayoutChanged;
            this.view.Caret.PositionChanged += this.OnPositionChanged;

            this.tagAggregatorService = tagAggregatorService;

            // Create the pen and brush to color the box behind the a's
            this.brush = new SolidColorBrush(Color.FromArgb(0x20, 0x00, 0x00, 0xff));
            this.brush.Freeze();

            //skimNavigationService = new SkimNavigationService(view, view.TextDataModel.DocumentBuffer, tagAggregatorService.CreateTagAggregator<IStructureTag>(view));

            var penBrush = new SolidColorBrush(Colors.Red);

            penBrush.Freeze();
            this.pen = new Pen(penBrush, 0.5);
            this.pen.Freeze();
        }
        internal ClassifierAggregator(ITextView textView,
                                      IViewTagAggregatorFactoryService viewTagAggregatorFactory,
                                      IClassificationTypeRegistryService classificationTypeRegistry)
        {
            // Validate.
            if (textView == null)
            {
                throw new ArgumentNullException(nameof(textView));
            }
            if (viewTagAggregatorFactory == null)
            {
                throw new ArgumentNullException(nameof(viewTagAggregatorFactory));
            }
            if (classificationTypeRegistry == null)
            {
                throw new ArgumentNullException(nameof(classificationTypeRegistry));
            }

            _textBuffer = textView.TextBuffer;
            _classificationTypeRegistry = classificationTypeRegistry;

            // Create a tag aggregator that maps by content type, so we don't map through projection buffers that aren't "projection" content type.
            _tagAggregator = viewTagAggregatorFactory.CreateTagAggregator <IClassificationTag>(textView, TagAggregatorOptions.MapByContentType) as IAccurateTagAggregator <IClassificationTag>;
            _tagAggregator.BatchedTagsChanged += OnBatchedTagsChanged;
        }
Exemple #13
0
        public InlineCommentMargin(
            IWpfTextViewHost wpfTextViewHost,
            IInlineCommentPeekService peekService,
            IEditorFormatMapService editorFormatMapService,
            IViewTagAggregatorFactoryService tagAggregatorFactory,
            Lazy <IPullRequestSessionManager> sessionManager)
        {
            textView            = wpfTextViewHost.TextView;
            this.sessionManager = sessionManager.Value;

            // Default to not show comment margin
            textView.Options.SetOptionValue(InlineCommentTextViewOptions.MarginEnabledId, false);

            marginGrid = new GlyphMarginGrid {
                Width = 17.0
            };
            var glyphFactory    = new InlineCommentGlyphFactory(peekService, textView);
            var editorFormatMap = editorFormatMapService.GetEditorFormatMap(textView);

            glyphMargin = new GlyphMargin <InlineCommentTag>(textView, glyphFactory, marginGrid, tagAggregatorFactory,
                                                             editorFormatMap, MarginPropertiesName);

            if (IsDiffView())
            {
                TrackCommentGlyph(wpfTextViewHost, marginGrid);
            }

            currentSessionSubscription = this.sessionManager.WhenAnyValue(x => x.CurrentSession)
                                         .Subscribe(x => RefreshCurrentSession().Forget());

            visibleSubscription = marginGrid.WhenAnyValue(x => x.IsVisible)
                                  .Subscribe(x => textView.Options.SetOptionValue(InlineCommentTextViewOptions.MarginVisibleId, x));

            textView.Options.OptionChanged += (s, e) => RefreshMarginVisibility();
        }
 public UnusedDeclarationMarginProvider(
     [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
     IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
 {
     _serviceProvider = serviceProvider;
     _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
 }
 public UnusedDeclarationMarginProvider(
     [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
     IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
 {
     _serviceProvider = serviceProvider;
     _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
 }
Exemple #16
0
        public static SnapshotSpan?GetUri(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, ITextView textView, SnapshotPoint point)
        {
            if (viewTagAggregatorFactoryService == null)
            {
                throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
            }
            if (point.Snapshot == null)
            {
                throw new ArgumentException();
            }
            var pointSpan = new SnapshotSpan(point.Snapshot, point.Position, 0);

            using (var tagAggregator = viewTagAggregatorFactoryService.CreateTagAggregator <IUriTag>(textView)) {
                foreach (var tagSpan in tagAggregator.GetTags(new SnapshotSpan(point.Snapshot, point.Position, 0)))
                {
                    foreach (var span in tagSpan.Span.GetSpans(point.Snapshot))
                    {
                        if (span.IntersectsWith(pointSpan))
                        {
                            return(span);
                        }
                    }
                }
            }
            return(null);
        }
 protected AbstractAdornmentManagerProvider(
     IViewTagAggregatorFactoryService tagAggregatorFactoryService,
     IAsynchronousOperationListenerProvider listenerProvider)
 {
     _tagAggregatorFactoryService = tagAggregatorFactoryService;
     _asyncListener = listenerProvider.GetListener(this.FeatureAttributeName);
 }
Exemple #18
0
 public LintQuickInfoProvider(
     [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
     IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
 {
     _serviceProvider = serviceProvider;
     _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
 }
Exemple #19
0
        public GlyphMargin(IMenuService menuService, IWpfTextViewHost wpfTextViewHost, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, Lazy <IGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata>[] glyphMouseProcessorProviders, Lazy <IGlyphFactoryProvider, IGlyphMetadata>[] glyphFactoryProviders, IMarginContextMenuService marginContextMenuHandlerProviderService)
        {
            if (menuService is null)
            {
                throw new ArgumentNullException(nameof(menuService));
            }
            glyphFactories       = new Dictionary <Type, GlyphFactoryInfo>();
            childCanvases        = Array.Empty <Canvas>();
            this.wpfTextViewHost = wpfTextViewHost ?? throw new ArgumentNullException(nameof(wpfTextViewHost));
            this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService ?? throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
            this.editorFormatMapService          = editorFormatMapService ?? throw new ArgumentNullException(nameof(editorFormatMapService));
            lazyGlyphMouseProcessorProviders     = glyphMouseProcessorProviders ?? throw new ArgumentNullException(nameof(glyphMouseProcessorProviders));
            lazyGlyphFactoryProviders            = glyphFactoryProviders ?? throw new ArgumentNullException(nameof(glyphFactoryProviders));

            var binding = new Binding {
                Path   = new PropertyPath(BackgroundProperty),
                Source = this,
            };

            SetBinding(DsImage.BackgroundBrushProperty, binding);

            wpfTextViewHost.TextView.Options.OptionChanged += Options_OptionChanged;
            wpfTextViewHost.TextView.ZoomLevelChanged      += TextView_ZoomLevelChanged;
            IsVisibleChanged += GlyphMargin_IsVisibleChanged;
            UpdateVisibility();
            Width        = MARGIN_WIDTH;
            ClipToBounds = true;
            menuService.InitializeContextMenu(VisualElement, new Guid(MenuConstants.GUIDOBJ_GLYPHMARGIN_GUID), marginContextMenuHandlerProviderService.Create(wpfTextViewHost, this, PredefinedMarginNames.Glyph), null, new Guid(MenuConstants.GLYPHMARGIN_GUID));
        }
Exemple #20
0
            public MarkFactory(IWpfTextView view, IViewTagAggregatorFactoryService aggregatorFactoryService)
            {
                _markerAggregator = aggregatorFactoryService.CreateTagAggregator <IVsVisibleTextMarkerTag>(view);

                _markerAggregator.TagsChanged += OnTagsChanged;

                view.Closed += OnClosed;
            }
		public UriQuickInfoSource(IWpfTextView textView, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService) {
			if (textView == null)
				throw new ArgumentNullException(nameof(textView));
			if (viewTagAggregatorFactoryService == null)
				throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
			this.textView = textView;
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
		}
        public MarksEnumerator(IViewTagAggregatorFactoryService aggregator_factory, ITextView view)
        {
            _view = view;
            _view.Closed += OnViewClosed;

            _aggregator = aggregator_factory.CreateTagAggregator<IVsVisibleTextMarkerTag>(view);
            _aggregator.BatchedTagsChanged += OnTagsChanged;
        }
 public StringIndentationAdornmentManagerProvider(
     IThreadingContext threadingContext,
     IViewTagAggregatorFactoryService tagAggregatorFactoryService,
     IGlobalOptionService globalOptions,
     IAsynchronousOperationListenerProvider listenerProvider)
     : base(threadingContext, tagAggregatorFactoryService, globalOptions, listenerProvider)
 {
 }
Exemple #24
0
        public ChangeEnumerator(IViewTagAggregatorFactoryService aggregator_factory, ITextView view)
        {
            _view         = view;
            _view.Closed += OnViewClosed;

            _aggregator = aggregator_factory.CreateTagAggregator <ChangeTag>(view);
            _aggregator.BatchedTagsChanged += OnTagsChanged;
        }
        public GoToMouseProcessorProvider(TextViewConnectionListener textViewConnectionListener,
                                          IViewTagAggregatorFactoryService viewTagAggregatorFactoryService,
                                          GoToLocationService goToLocationService) {

            _textViewConnectionListener      = textViewConnectionListener;
            _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
            _goToLocationService             = goToLocationService;
        }
Exemple #26
0
		GlyphMarginProvider(IMenuService menuService, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, [ImportMany] IEnumerable<Lazy<IGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata>> glyphMouseProcessorProviders, [ImportMany] IEnumerable<Lazy<IGlyphFactoryProvider, IGlyphMetadata>> glyphFactoryProviders, IMarginContextMenuService marginContextMenuHandlerProviderService) {
			this.menuService = menuService;
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			this.editorFormatMapService = editorFormatMapService;
			this.glyphMouseProcessorProviders = Orderer.Order(glyphMouseProcessorProviders).ToArray();
			this.glyphFactoryProviders = Orderer.Order(glyphFactoryProviders).ToArray();
			this.marginContextMenuHandlerProviderService = marginContextMenuHandlerProviderService;
		}
Exemple #27
0
 public VersionControlViewTaggerProvider(
     [ImportMany]
     IVersionControlClassifier[] classifiers,
     IViewTagAggregatorFactoryService tagAggregator)
 {
     _tagAggregator = tagAggregator;
     _classifiers   = classifiers;
 }
        public SuggestedActionsSource(IViewTagAggregatorFactoryService tagService, ISuggestedActionCategoryRegistryService suggestedActionCategoryRegistry, ITextView view, ITextBuffer textBuffer, string file)
        {
            this.tagService = tagService;
            this.suggestedActionCategoryRegistry = suggestedActionCategoryRegistry;
            this.view = view;
            this.file = file;

            RapidXamlDocumentCache.Add(this.file, textBuffer.CurrentSnapshot);
        }
Exemple #29
0
 public DepthColorizerAdornmentManager(
     [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
     ThemeManager themeManager,
     IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
 {
     _serviceProvider = serviceProvider;
     _themeManager    = themeManager;
     _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
 }
 public LineSeparatorAdornmentManagerProvider(
     IViewTagAggregatorFactoryService tagAggregatorFactoryService,
     [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
 {
     _tagAggregatorFactoryService = tagAggregatorFactoryService;
     _asyncListener = new AggregateAsynchronousOperationListener(
         asyncListeners,
         FeatureAttribute.LineSeparators);
 }
 public HighlightUsageFilterProvider(
     [Import(typeof(SVsServiceProvider))] System.IServiceProvider serviceProvider,
     IViewTagAggregatorFactoryService tagAggregator,
     IVsEditorAdaptersFactoryService editorFactory)
 {
     _serviceProvider = serviceProvider;
     _tagAggregator   = tagAggregator;
     _editorFactory   = editorFactory;
 }
 public StringIndentationAdornmentManager(
     IThreadingContext threadingContext,
     IWpfTextView textView,
     IViewTagAggregatorFactoryService tagAggregatorFactoryService,
     IAsynchronousOperationListener asyncListener,
     string adornmentLayerName)
     : base(threadingContext, textView, tagAggregatorFactoryService, asyncListener, adornmentLayerName)
 {
 }
 protected AbstractAdornmentManagerProvider(
     IViewTagAggregatorFactoryService tagAggregatorFactoryService,
     IEnumerable <Lazy <IAsynchronousOperationListener, FeatureMetadata> > asyncListeners)
 {
     _tagAggregatorFactoryService = tagAggregatorFactoryService;
     _asyncListener = new AggregateAsynchronousOperationListener(
         asyncListeners,
         this.FeatureAttributeName);
 }
 protected AbstractAdornmentManagerProvider(
     IThreadingContext threadingContext,
     IViewTagAggregatorFactoryService tagAggregatorFactoryService,
     IAsynchronousOperationListenerProvider listenerProvider)
 {
     ThreadingContext            = threadingContext;
     TagAggregatorFactoryService = tagAggregatorFactoryService;
     AsyncListener = listenerProvider.GetListener(this.FeatureAttributeName);
 }
 public HighlightUsageFilterProvider(
     [Import(typeof(SVsServiceProvider))] System.IServiceProvider serviceProvider,
     IViewTagAggregatorFactoryService tagAggregator,
     IVsEditorAdaptersFactoryService editorFactory)
 {
     _serviceProvider = serviceProvider;
     _tagAggregator = tagAggregator;
     _editorFactory = editorFactory;
 }
 public LineSeparatorAdornmentManagerProvider(
     IViewTagAggregatorFactoryService tagAggregatorFactoryService,
     [ImportMany] IEnumerable <Lazy <IAsynchronousOperationListener, FeatureMetadata> > asyncListeners)
 {
     _tagAggregatorFactoryService = tagAggregatorFactoryService;
     _asyncListener = new AggregateAsynchronousOperationListener(
         asyncListeners,
         FeatureAttribute.LineSeparators);
 }
Exemple #37
0
 GlyphMarginProvider(IMenuService menuService, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, [ImportMany] IEnumerable <Lazy <IGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata> > glyphMouseProcessorProviders, [ImportMany] IEnumerable <Lazy <IGlyphFactoryProvider, IGlyphMetadata> > glyphFactoryProviders, IMarginContextMenuService marginContextMenuHandlerProviderService)
 {
     this.menuService = menuService;
     this.viewTagAggregatorFactoryService         = viewTagAggregatorFactoryService;
     this.editorFormatMapService                  = editorFormatMapService;
     this.glyphMouseProcessorProviders            = Orderer.Order(glyphMouseProcessorProviders).ToArray();
     this.glyphFactoryProviders                   = Orderer.Order(glyphFactoryProviders).ToArray();
     this.marginContextMenuHandlerProviderService = marginContextMenuHandlerProviderService;
 }
        public DocumentMarkMarginProvider(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService,
                                          [ImportMany] IEnumerable <Lazy <IGlyphFactoryProvider, IGlyphMetadata> > glyphFactoryProviders)
        {
            _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;

            // only get _our_ glyph factory
            _glyphFactoryProviders = Orderer.Order(glyphFactoryProviders)
                                     .Where(_ => _.Metadata.Name == PredefinedCodestreamNames.DocumentMarkGlyphFactoryProvider).ToArray();
        }
 GlyphTextMarkerService(IModuleIdProvider moduleIdProvider, IThemeService themeService, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, [ImportMany] IEnumerable <Lazy <IGlyphTextMarkerMouseProcessorProvider, IGlyphTextMarkerMouseProcessorProviderMetadata> > glyphTextMarkerMouseProcessorProviders)
 {
     this.moduleIdProvider                       = moduleIdProvider;
     ThemeService                                = themeService;
     ViewTagAggregatorFactoryService             = viewTagAggregatorFactoryService;
     EditorFormatMapService                      = editorFormatMapService;
     this.glyphTextMarkers                       = new HashSet <IGlyphTextMarkerImpl>();
     this.GlyphTextMarkerMouseProcessorProviders = Orderer.Order(glyphTextMarkerMouseProcessorProviders).ToArray();
 }
Exemple #40
0
 public UriMouseProcessor(IWpfTextView wpfTextView, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IMessageBoxService messageBoxService)
 {
     this.wpfTextView       = wpfTextView ?? throw new ArgumentNullException(nameof(wpfTextView));
     this.messageBoxService = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService));
     this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService ?? throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
     origCursor = wpfTextView.VisualElement.Cursor;
     wpfTextView.VisualElement.PreviewKeyDown += VisualElement_PreviewKeyDown;
     wpfTextView.VisualElement.PreviewKeyUp   += VisualElement_PreviewKeyUp;
     wpfTextView.Closed += WpfTextView_Closed;
 }
        GoToDefinitionMouseProcessor(IWpfTextView textView, TextViewConnectionListener textViewConnectionListener, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService) {
            _textView      = textView;
            _tagAggregator = viewTagAggregatorFactoryService.CreateTagAggregator<GoToDefinitionTag>(textView);
            _keyState      = ModifierKeyState.GetStateForView(textView, textViewConnectionListener);

            _textView.LostAggregateFocus += OnTextViewLostAggregateFocus; 
            _keyState.KeyStateChanged    += OnKeyStateChanged;

            textViewConnectionListener.AddDisconnectAction(textView, RemoveMouseProcessorForView);
        }
Exemple #42
0
 internal ExternalEditManager(IVimBuffer buffer, IVsTextLines vsTextLines, IViewTagAggregatorFactoryService tagAggregatorFactoryService)
 {
     _vsTextLines = vsTextLines;
     _tagAggregator = tagAggregatorFactoryService.CreateTagAggregator<ITag>(buffer.TextView);
     _buffer = buffer;
     _buffer.TextView.LayoutChanged += OnLayoutChanged;
     _buffer.SwitchedMode += OnSwitchedMode;
     _externalEditorAdapters.Add(new SnippetExternalEditorAdapter());
     _externalEditorAdapters.Add(new ResharperExternalEditorAdapter());
 }
 public TestGlyphMouseProcessor(
     IWpfTextViewHost viewHost,
     IViewTagAggregatorFactoryService viewTagService,
     DTE dte
     )
 {
     _viewHost = viewHost;
     _viewTagService = viewTagService;
     _dte = (DTE2) dte;
     _testTagAggregator = viewTagService.CreateTagAggregator<TestTag>(
         viewHost.TextView);
 }
Exemple #44
0
		public static IMappingTagSpan<IUrlTag> GetUri(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, ITextView textView, SnapshotPoint point) {
			if (viewTagAggregatorFactoryService == null)
				throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
			if (point.Snapshot == null)
				throw new ArgumentException();
			using (var tagAggregator = viewTagAggregatorFactoryService.CreateTagAggregator<IUrlTag>(textView)) {
				foreach (var tagSpan in tagAggregator.GetTags(new SnapshotSpan(point.Snapshot, point.Position, 0))) {
					foreach (var span in tagSpan.Span.GetSpans(point.Snapshot)) {
						if (span.Start <= point && point < span.End)
							return tagSpan;
					}
				}
			}
			return null;
		}
Exemple #45
0
 internal ExternalEditorManager(
     SVsServiceProvider serviceProvider,
     IVsAdapter vsAdapter,
     IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
 {
     _vsAdapter = vsAdapter;
     _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
     _vsShell = serviceProvider.GetService<SVsShell, IVsShell>();
     _adapterList.Add(new SnippetExternalEditAdapter());
     _isResharperInstalled = CheckResharperInstalled();
     if (_isResharperInstalled)
     {
         _adapterList.Add(new ResharperExternalEditAdapter());
     }
 }
		public UriMouseProcessor(IWpfTextView wpfTextView, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IMessageBoxService messageBoxService) {
			if (wpfTextView == null)
				throw new ArgumentNullException(nameof(wpfTextView));
			if (viewTagAggregatorFactoryService == null)
				throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
			if (messageBoxService == null)
				throw new ArgumentNullException(nameof(messageBoxService));
			this.wpfTextView = wpfTextView;
			this.messageBoxService = messageBoxService;
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			origCursor = wpfTextView.VisualElement.Cursor;
			wpfTextView.VisualElement.PreviewKeyDown += VisualElement_PreviewKeyDown;
			wpfTextView.VisualElement.PreviewKeyUp += VisualElement_PreviewKeyUp;
			wpfTextView.Closed += WpfTextView_Closed;
		}
Exemple #47
0
        /// <summary>
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        public TestAdorn(IWpfTextView view, TextInvisTagger tit, IViewTagAggregatorFactoryService tafs)
        {
            _view = view;
            _tit = tit;

            tagAggregator = tafs.CreateTagAggregator<TextInvisTag>(_view);

            //Grab a reference to the adornment layer that this adornment should be added to
            _adornmentLayer = view.GetAdornmentLayer("FocusArea");

            _view.ViewportHeightChanged += delegate { this.onSizeChange(); };
            _view.ViewportWidthChanged += delegate { this.onSizeChange(); };

            //_tit.ScrollNumberFixed += delegate { this.onSizeChange(); };
            _view.LayoutChanged += delegate { this.onSizeChange(); };            //may have problems
            //_view.LayoutChanged += new EventHandler<TextViewLayoutChangedEventArgs>(_view_LayoutChanged);
        }
		public LineSeparatorService(IWpfTextView wpfTextView, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService) {
			if (wpfTextView == null)
				throw new ArgumentNullException(nameof(wpfTextView));
			if (viewTagAggregatorFactoryService == null)
				throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
			if (editorFormatMapService == null)
				throw new ArgumentNullException(nameof(editorFormatMapService));
			this.wpfTextView = wpfTextView;
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			this.editorFormatMapService = editorFormatMapService;
			lineSeparatorElements = new List<LineSeparatorElement>();
			usedLines = new HashSet<object>();
			onRemovedDelegate = OnRemoved;
			wpfTextView.Closed += WpfTextView_Closed;
			wpfTextView.Options.OptionChanged += Options_OptionChanged;
			UpdateLineSeparator();
		}
		UriQuickInfoSourceProvider(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService) {
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
		}
 public UrlCommandFilterProvider(SVsServiceProvider serviceProvider, IVsEditorAdaptersFactoryService editorAdaptersFactoryService, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
 {
     this.ServiceProvider = serviceProvider;
     this.EditorAdaptersFactoryService = editorAdaptersFactoryService;
     this.ViewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
 }
 public GoToDefinitionMouseProcessorProvider(TextViewConnectionListener textViewConnectionListener,
                                         IViewTagAggregatorFactoryService viewTagAggregatorFactoryService) {
     _textViewConnectionListener      = textViewConnectionListener;
     _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
 }
Exemple #52
0
 internal static void Monitor(IVimBuffer buffer, IVsTextLines vsTextLines, IViewTagAggregatorFactoryService tagAggregatorFactoryService)
 {
     new ExternalEditManager(buffer, vsTextLines, tagAggregatorFactoryService);
 }
		UriMouseProcessorProvider(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IMessageBoxService messageBoxService) {
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			this.messageBoxService = messageBoxService;
		}
		LineSeparatorServiceProvider(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService) {
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			this.editorFormatMapService = editorFormatMapService;
		}
Exemple #55
0
		public GlyphMargin(IMenuService menuService, IWpfTextViewHost wpfTextViewHost, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, Lazy<IGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata>[] glyphMouseProcessorProviders, Lazy<IGlyphFactoryProvider, IGlyphMetadata>[] glyphFactoryProviders, IMarginContextMenuService marginContextMenuHandlerProviderService) {
			if (menuService == null)
				throw new ArgumentNullException(nameof(menuService));
			if (wpfTextViewHost == null)
				throw new ArgumentNullException(nameof(wpfTextViewHost));
			if (viewTagAggregatorFactoryService == null)
				throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
			if (editorFormatMapService == null)
				throw new ArgumentNullException(nameof(editorFormatMapService));
			if (glyphMouseProcessorProviders == null)
				throw new ArgumentNullException(nameof(glyphMouseProcessorProviders));
			if (glyphFactoryProviders == null)
				throw new ArgumentNullException(nameof(glyphFactoryProviders));
			glyphFactories = new Dictionary<Type, GlyphFactoryInfo>();
			childCanvases = Array.Empty<Canvas>();
			this.wpfTextViewHost = wpfTextViewHost;
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			this.editorFormatMapService = editorFormatMapService;
			lazyGlyphMouseProcessorProviders = glyphMouseProcessorProviders;
			lazyGlyphFactoryProviders = glyphFactoryProviders;

			var binding = new Binding {
				Path = new PropertyPath(BackgroundProperty),
				Source = this,
			};
			SetBinding(DsImage.BackgroundBrushProperty, binding);

			wpfTextViewHost.TextView.Options.OptionChanged += Options_OptionChanged;
			wpfTextViewHost.TextView.ZoomLevelChanged += TextView_ZoomLevelChanged;
			IsVisibleChanged += GlyphMargin_IsVisibleChanged;
			UpdateVisibility();
			Width = MARGIN_WIDTH;
			ClipToBounds = true;
			menuService.InitializeContextMenu(VisualElement, new Guid(MenuConstants.GUIDOBJ_GLYPHMARGIN_GUID), marginContextMenuHandlerProviderService.Create(wpfTextViewHost, this, PredefinedMarginNames.Glyph), null, new Guid(MenuConstants.GLYPHMARGIN_GUID));
		}