本文整理汇总了C#中IVsEditorAdaptersFactoryService.GetViewAdapter方法的典型用法代码示例。如果您正苦于以下问题:C# IVsEditorAdaptersFactoryService.GetViewAdapter方法的具体用法?C# IVsEditorAdaptersFactoryService.GetViewAdapter怎么用?C# IVsEditorAdaptersFactoryService.GetViewAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsEditorAdaptersFactoryService
的用法示例。
在下文中一共展示了IVsEditorAdaptersFactoryService.GetViewAdapter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConnectController
public static CommandTargetToOleShim ConnectController(IVsEditorAdaptersFactoryService adapterService, ITextView textView, Controller controller) {
IVsTextView viewAdapter = adapterService.GetViewAdapter(textView);
CommandTargetToOleShim oleControllerShim = null;
// Connect main controller to VS text view filter chain.
// The chain looks like VS IDE -> language main controller -> Core editor
// However, IDE wants IOleCommandTarget and core editor, although managed,
// is represented by OLE command target as well. Since R controller
// is not specific to VS and does not use OLE, we create OLE-to-managed target shim
// and managed target-to-OLE shims.
if (viewAdapter != null) {
// Create OLE shim that wraps main controller ICommandTarget and represents
// it as IOleCommandTarget that is accepted by VS IDE.
oleControllerShim = new CommandTargetToOleShim(textView, controller);
IOleCommandTarget nextOleTarget;
viewAdapter.AddCommandFilter(oleControllerShim, out nextOleTarget);
// nextOleTarget is typically a core editor wrapped into OLE layer.
// Create a wrapper that will present OLE target as ICommandTarget to
// HTML main controller so controller can operate in platform-agnostic way.
ICommandTarget nextCommandTarget = VsAppShell.Current.TranslateCommandTarget(textView, nextOleTarget);
controller.ChainedController = nextCommandTarget;
}
return oleControllerShim;
}
示例2: ExpansionClient
public ExpansionClient(ITextView textView, IVsEditorAdaptersFactoryService adapterFactory, IServiceProvider serviceProvider) {
_textView = textView;
_serviceProvider = serviceProvider;
_view = adapterFactory.GetViewAdapter(textView);
_lines = (IVsTextLines)adapterFactory.GetBufferAdapter(textView.TextBuffer);
_expansion = _lines as IVsExpansion;
if (_expansion == null) {
throw new ArgumentException("TextBuffer does not support expansions");
}
}
示例3: DataTipTextViewFilter
private DataTipTextViewFilter(IWpfTextView textView, IVsEditorAdaptersFactoryService adapterService, IVsDebugger debugger) {
Trace.Assert(textView.TextBuffer.ContentType.IsOfType(RContentTypeDefinition.ContentType));
_textView = textView;
_debugger = debugger;
_vsTextView = adapterService.GetViewAdapter(textView);
_vsTextView.AddCommandFilter(this, out _nextTarget);
_vsTextView.GetBuffer(out _vsTextLines);
textView.Properties.AddProperty(typeof(DataTipTextViewFilter), this);
}
示例4: DisconnectController
public static void DisconnectController(IVsEditorAdaptersFactoryService adapterService, ITextView textView, CommandTargetToOleShim oleControllerShim) {
IVsTextView viewAdapter = adapterService.GetViewAdapter(textView);
if (viewAdapter != null) {
viewAdapter.RemoveCommandFilter(oleControllerShim);
}
}
示例5: OnCreate
protected override void OnCreate()
{
_replWindow.Initialize();
_adapterFactory = _replWindow.ComponentModel.GetService<IVsEditorAdaptersFactoryService>();
var textView = _replWindow.CurrentView;
SetDefaultFontSize(_replWindow.ComponentModel, textView);
// create adapters so VS is happy...
var serviceProvider = (Microsoft.VisualStudio.OLE.Interop.IServiceProvider)GetService(typeof(Microsoft.VisualStudio.OLE.Interop.IServiceProvider));
_view = _adapterFactory.GetViewAdapter(textView);
_findTarget = _view as IVsFindTarget;
CurrentView.Closed += OnClose;
_content = _replWindow.Content;
}