本文整理汇总了C#中IElement.GetReferences方法的典型用法代码示例。如果您正苦于以下问题:C# IElement.GetReferences方法的具体用法?C# IElement.GetReferences怎么用?C# IElement.GetReferences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IElement
的用法示例。
在下文中一共展示了IElement.GetReferences方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessAfterInterior
public void ProcessAfterInterior(IElement element)
{
Assert.CheckNotNull(element);
foreach (IReference reference in element.GetReferences())
{
IDeclaredElement resolved = reference.Resolve().DeclaredElement;
if(resolved is IConstructor)
{
resolved = resolved.GetContainingType();
}
{
ITypeElement typeElement = resolved as ITypeElement;
if (typeElement != null)
{
// IDeclaredType declaredType = TypeFactory.CreateType(typeElement);
IModule module = resolved.Module;
if (candidates.Contains(module))
candidates.Remove(module);
}
}
}
}
示例2: ProcessReferences
protected void ProcessReferences(IElement element)
{
if(!CheckElement(element))
return;
IReference[] references = element.GetReferences();
foreach (IReference reference in references)
{
CheckForResolveProblems(reference, element);
if (!reference.IsValid())
{
//ResolveErrorType result = reference.CheckResolveResult();
// TODO hightlight "can not resolve symbol 'blahblah' "
//if( reference.CheckResolveResult() == ResolveErrorType. ...)
}
else
{
HighlightReference(element, reference);
}
}
}
示例3: ProcessIdentifiers
private void ProcessIdentifiers(IElement element)
{
IReference[] references = element.GetReferences();
foreach (IReference reference in references)
{
CheckForResolveProblems(reference);
if(!reference.IsValid())
{
//ResolveErrorType result = reference.CheckResolveResult();
// TODO hightlight "can not resolve symbol 'blahblah' "
//if( reference.CheckResolveResult() == ResolveErrorType. ...)
}
else if(reference.ReferenceType == ReferenceType.TEXT
|| reference.ReferenceType == ReferenceType.REFERENCE_NAME)
{
ResolveResult resolveResult = reference.Resolve();
if(resolveResult.DeclaredElement != null)
{
DocumentRange range = reference.GetDocumentRange();
DocumentRange footerRange = GetFooterTagRange(element, range);
Highlight(range, resolveResult.DeclaredElement);
if (footerRange != DocumentRange.InvalidRange)
Highlight(footerRange, resolveResult.DeclaredElement);
}
}
}
if (element is IAppenderRef)
{
Highlight(((IXmlTag)element).ToTreeNode().Header.Name, HighlightingAttributeIds.FIELD_IDENTIFIER_ATTRIBUTE);
}
// TODO remove double code
if(element is ILogger && ((ILogger)element).TagName == L4NConstants.ROOT_LOGGER)
{
IXmlTagNode treeNode = ((IXmlTag)element).ToTreeNode();
// TODO use ILoggerElement to get header range
Highlight(treeNode.Header.Name, HighlightingAttributeIds.CONSTANT_IDENTIFIER_ATTRIBUTE);
}
else if(element is IAppender || element is ILogger)
{
// TODO use IAppenderElement to get header range
IXmlTagNode treeNode = ((IXmlTag)element).ToTreeNode();
Highlight(treeNode.Header.Name, HighlightingAttributeIds.TYPE_IDENTIFIER_ATTRIBUTE);
}
// TODO tooltips for predefined tags appender, appender-ref, logger, level etc
}