当前位置: 首页>>代码示例>>C#>>正文


C# IVsEditorAdaptersFactoryService.GetWpfTextView方法代码示例

本文整理汇总了C#中IVsEditorAdaptersFactoryService.GetWpfTextView方法的典型用法代码示例。如果您正苦于以下问题:C# IVsEditorAdaptersFactoryService.GetWpfTextView方法的具体用法?C# IVsEditorAdaptersFactoryService.GetWpfTextView怎么用?C# IVsEditorAdaptersFactoryService.GetWpfTextView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVsEditorAdaptersFactoryService的用法示例。


在下文中一共展示了IVsEditorAdaptersFactoryService.GetWpfTextView方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ContainsImmediateWindow

        internal static bool ContainsImmediateWindow(this IEnumerable<IVsTextView> vsTextViews, IVsUIShell shellService, IVsEditorAdaptersFactoryService _editorAdaptersFactoryService)
        {
            IEnumWindowFrames windowEnum = null;
            Marshal.ThrowExceptionForHR(shellService.GetToolWindowEnum(out windowEnum));

            IVsWindowFrame[] frame = new IVsWindowFrame[1];
            uint value;

            var immediateWindowGuid = Guid.Parse(ToolWindowGuids80.ImmediateWindow);

            while (windowEnum.Next(1, frame, out value) == VSConstants.S_OK)
            {
                Guid toolWindowGuid;
                Marshal.ThrowExceptionForHR(frame[0].GetGuidProperty((int)__VSFPROPID.VSFPROPID_GuidPersistenceSlot, out toolWindowGuid));
                if (toolWindowGuid == immediateWindowGuid)
                {
                    IntPtr frameTextView;
                    Marshal.ThrowExceptionForHR(frame[0].QueryViewInterface(typeof(IVsTextView).GUID, out frameTextView));
                    try
                    {
                        var immediateWindowTextView = Marshal.GetObjectForIUnknown(frameTextView) as IVsTextView;
                        var immediateWindowWpfTextView = _editorAdaptersFactoryService.GetWpfTextView(immediateWindowTextView);
                        return vsTextViews.Any(vsTextView => _editorAdaptersFactoryService.GetWpfTextView(vsTextView) == immediateWindowWpfTextView);
                    }
                    finally
                    {
                        Marshal.Release(frameTextView);
                    }
                }
            }

            return false;
        }
开发者ID:JackWangCUMT,项目名称:roslyn,代码行数:33,代码来源:IVsTextViewExtensions.cs

示例2: TextViewFilter

        public TextViewFilter(IServiceProvider serviceProvider, IVsTextView vsTextView) {
            var compModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
            _vsEditorAdaptersFactoryService = compModel.GetService<IVsEditorAdaptersFactoryService>();
            _debugger = (IVsDebugger)serviceProvider.GetService(typeof(IVsDebugger));

            vsTextView.GetBuffer(out _vsTextLines);
            _wpfTextView = _vsEditorAdaptersFactoryService.GetWpfTextView(vsTextView);

            ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out _next));
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:10,代码来源:TextViewFilter.cs

示例3: DartCodeWindowManager

        public DartCodeWindowManager(ITextDocumentFactoryService textDocumentFactory, IVsEditorAdaptersFactoryService editorAdapterFactory, IVsCodeWindow codeWindow, DartAnalysisServiceFactory analysisServiceFactory)
        {
            this.barManager = ((IVsDropdownBarManager)codeWindow);
            this.analysisServiceFactory = analysisServiceFactory;

            // Figure out the filename (seriously; this is the best way?!).
            IVsTextView textView;
            codeWindow.GetPrimaryView(out textView);
            wpfTextView = editorAdapterFactory.GetWpfTextView(textView);
            textDocumentFactory.TryGetTextDocument(wpfTextView.TextBuffer, out this.textDocument);
        }
开发者ID:modulexcite,项目名称:DartVS,代码行数:11,代码来源:DartCodeWindowManager.cs

示例4: GetActiveTextView

        public static IWpfTextView GetActiveTextView( IVsEditorAdaptersFactoryService AdaptersFactory)
        {
            IVsTextManager service = IServiceProviderExtensions.GetService<SVsTextManager, IVsTextManager>(DteExtensions.ToIServiceProvider());
            IVsTextView ppView = (IVsTextView)null;
            service.GetActiveView(1, (IVsTextBuffer)null, out ppView);
            if (ppView != null)
            {
                try
                {
                    return AdaptersFactory.GetWpfTextView(ppView);

                }
                catch
                {
                }
            }
            return (IWpfTextView)null;
        }
开发者ID:gramcha,项目名称:XFeatures,代码行数:18,代码来源:DteExtensions.cs

示例5: EditorNavigationDropdownBarClient

        public EditorNavigationDropdownBarClient(IVsCodeWindow codeWindow, IVsEditorAdaptersFactoryService editorAdaptersFactory, EditorNavigationSource source, IBufferGraphFactoryService bufferGraphFactoryService)
        {
            _codeWindow = codeWindow;
            _editorAdaptersFactory = editorAdaptersFactory;
            _source = source;
            _bufferGraphFactoryService = bufferGraphFactoryService;
            _currentTextView = editorAdaptersFactory.GetWpfTextView(codeWindow.GetLastActiveView());
            _dispatcher = _currentTextView.VisualElement.Dispatcher;
            _imageList = new ImageList
            {
                ColorDepth = ColorDepth.Depth32Bit
            };

            var connectionPointContainer = codeWindow as IConnectionPointContainer;
            if (connectionPointContainer != null)
            {
                var textViewEventsGuid = typeof(IVsCodeWindowEvents).GUID;
                IConnectionPoint connectionPoint;
                connectionPointContainer.FindConnectionPoint(ref textViewEventsGuid, out connectionPoint);
                connectionPoint?.Advise(this, out _codeWindowEventsCookie);
            }

            var primaryView = codeWindow.GetPrimaryView();
            if (primaryView != null)
                ((IVsCodeWindowEvents)this).OnNewView(primaryView);

            var secondaryView = codeWindow.GetSecondaryView();
            if (secondaryView != null)
                ((IVsCodeWindowEvents)this).OnNewView(secondaryView);

            _navigationItems = new List<EditorTypeNavigationTarget>();

            source.NavigationTargetsChanged += OnNavigationTargetsChanged;
            UpdateNavigationTargets();

            _currentTextView.Caret.PositionChanged += OnCaretPositionChanged;
        }
开发者ID:pminiszewski,项目名称:HlslTools,代码行数:37,代码来源:EditorNavigationDropdownBarClient.cs

示例6: CreateEditorNavigationDropdownBar

        public IEditorNavigationDropdownBarClient CreateEditorNavigationDropdownBar(IVsCodeWindow codeWindow, IVsEditorAdaptersFactoryService editorAdaptersFactory)
        {
            // a code window can only be associated with a single buffer, so the primary view will get us the correct information
            IVsTextView primaryViewAdapter = codeWindow.GetPrimaryView();
            IWpfTextView textView = editorAdaptersFactory.GetWpfTextView(primaryViewAdapter);

            IBufferGraph bufferGraph = BufferGraphFactoryService.CreateBufferGraph(textView.TextBuffer);
            Collection<ITextBuffer> buffers = bufferGraph.GetTextBuffers(i => true);

            List<IEditorNavigationSource> sources = new List<IEditorNavigationSource>();
            foreach (ITextBuffer buffer in buffers)
            {
                var bufferProviders = NavigationSourceProviders.Where(provider => provider.Metadata.ContentTypes.Any(contentType => buffer.ContentType.IsOfType(contentType)));

                var bufferSources =
                    bufferProviders
                    .Select(provider => provider.Value.TryCreateEditorNavigationSource(buffer))
                    .Where(source => source != null);

                sources.AddRange(bufferSources);
            }

            return new EditorNavigationDropdownBar(codeWindow, editorAdaptersFactory, sources, BufferGraphFactoryService, EditorNavigationTypeRegistryService);
        }
开发者ID:sebandraos,项目名称:LangSvcV2,代码行数:24,代码来源:EditorNavigationDropdownBarFactoryService.cs

示例7: EditorNavigationDropdownBar

        public EditorNavigationDropdownBar(IVsCodeWindow codeWindow, IVsEditorAdaptersFactoryService editorAdaptersFactory, IEnumerable<IEditorNavigationSource> sources, IBufferGraphFactoryService bufferGraphFactoryService, IJavaEditorNavigationTypeRegistryService 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;
        }
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:61,代码来源:EditorNavigationDropdownBar.cs

示例8: AddSkipFilter

 internal static void AddSkipFilter(IVsEditorAdaptersFactoryService adapterService, IVsTextView primaryView) {
     var skipJsFilter = new SkipJsLsFilter(primaryView);
     var wpfView = adapterService.GetWpfTextView(primaryView);
     wpfView.Properties[typeof(SkipJsLsFilter)] = skipJsFilter;
 }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:5,代码来源:CodeWindowManager.cs


注:本文中的IVsEditorAdaptersFactoryService.GetWpfTextView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。