本文整理汇总了C#中IVsAdapter.GetCodeWindow方法的典型用法代码示例。如果您正苦于以下问题:C# IVsAdapter.GetCodeWindow方法的具体用法?C# IVsAdapter.GetCodeWindow怎么用?C# IVsAdapter.GetCodeWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsAdapter
的用法示例。
在下文中一共展示了IVsAdapter.GetCodeWindow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryInstallFilterKeysAdapter
/// <summary>
/// Try and install the IVsFilterKeys adapter for the given ITextView.
/// </summary>
internal static bool TryInstallFilterKeysAdapter(
IVsAdapter adapter,
IVimBuffer buffer)
{
var textView = buffer.TextView;
if (textView.Properties.ContainsProperty(s_key))
{
return true;
}
var textLines = adapter.EditorAdapter.GetBufferAdapter(buffer.TextBuffer) as IVsTextLines;
if (textLines == null)
{
return false;
}
IVsCodeWindow codeWindow;
if (!adapter.GetCodeWindow(textView).TryGetValue(out codeWindow))
{
return false;
}
// Grab the field we need to replace. Be wary that Venus uses a different implementation
// and the field will not be available
var type = codeWindow.GetType();
var flags = System.Reflection.BindingFlags.Instance
| System.Reflection.BindingFlags.NonPublic;
var field = type.GetField(FieldName, flags);
if (field == null)
{
return false;
}
var oldValue = field.GetValue(codeWindow) as IVsFilterKeys;
if (oldValue == null)
{
return false;
}
var filterKeysAdapter = new VsFilterKeysAdapter(oldValue, codeWindow, adapter, buffer);
field.SetValue(codeWindow, filterKeysAdapter);
return true;
}