本文整理汇总了C#中ICSharpCode.NRefactory.Semantics.ResolveResult.GetDefinitionRegion方法的典型用法代码示例。如果您正苦于以下问题:C# ResolveResult.GetDefinitionRegion方法的具体用法?C# ResolveResult.GetDefinitionRegion怎么用?C# ResolveResult.GetDefinitionRegion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.Semantics.ResolveResult
的用法示例。
在下文中一共展示了ResolveResult.GetDefinitionRegion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public override void Run(ResolveResult symbol)
{
if (symbol == null)
return;
var trr = symbol as TypeResolveResult;
var def = symbol.Type.GetDefinition();
if (trr != null && def != null && def.Parts.Count > 1) {
ShowPopupWithPartialClasses(def);
return;
}
DomRegion pos = symbol.GetDefinitionRegion();
if (string.IsNullOrEmpty(pos.FileName)) {
IEntity entity = GetSymbol(symbol) as IEntity;
if (entity != null) {
NavigationService.NavigateTo(entity);
}
} else {
try {
if (pos.Begin.IsEmpty)
FileService.OpenFile(pos.FileName);
else
FileService.JumpToFilePosition(pos.FileName, pos.BeginLine, pos.BeginColumn);
} catch (Exception ex) {
MessageService.ShowException(ex, "Error jumping to '" + pos.FileName + "'.");
}
}
}
示例2: CanExecute
public override bool CanExecute(ResolveResult symbol)
{
if (symbol == null)
return false;
return !symbol.GetDefinitionRegion().IsEmpty;
}