本文整理汇总了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;
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}