本文整理汇总了C#中ITreeNode.GetPsiModule方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeNode.GetPsiModule方法的具体用法?C# ITreeNode.GetPsiModule怎么用?C# ITreeNode.GetPsiModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITreeNode
的用法示例。
在下文中一共展示了ITreeNode.GetPsiModule方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBasedOnRegistrations
public override IEnumerable<FilteredRegistrationBase> GetBasedOnRegistrations(ITreeNode registrationRootElement)
{
IStructuralMatchResult match = Match(registrationRootElement);
if (match.Matched)
{
ITypeElement objectTypeElement = registrationRootElement.GetPsiModule()
.GetPredefinedType()
.Object.GetTypeElement();
if (objectTypeElement != null)
{
yield return registrationCreator.Create(registrationRootElement, objectTypeElement);
}
}
}
示例2: CreatePsiRuleTarget
public CreatePsiRuleTarget(PsiRuleReference reference)
{
myReference = reference;
myElement = reference.GetTreeNode();
string name = reference.GetName();
var node = myElement.NextSibling;
while (node != null)
{
if (!node.IsWhitespaceToken())
{
if (!(node is IRuleParameters))
{
break;
}
var child = node.FirstChild;
while (child != null)
{
if (!child.IsWhitespaceToken())
{
if (child is IRuleBraceParameters)
{
myHasBraceParameters = true;
}
if (child is IRuleBracketParameters)
{
CollectVariableParameters(child as IRuleBracketParameters);
}
}
child = child.NextSibling;
}
break;
}
node = node.NextSibling;
}
myDeclaration = PsiElementFactory.GetInstance(myElement.GetPsiModule()).CreateRuleDeclaration(name, myHasBraceParameters, myVariableParameters);
Anchor = myElement.GetContainingNode<IRuleDeclaration>();
}
示例3: ProcessBeforeInterior
public void ProcessBeforeInterior(ITreeNode element)
{
var functionDeclaration = element as ICSharpFunctionDeclaration;
if (functionDeclaration == null)
return;
var psiModule = element.GetPsiModule();
var sourceFile = element.GetSourceFile();
if (sourceFile == null)
return;
var resolveContext = sourceFile.ResolveContext;
var disposableInterface = DisposeUtil.GetDisposableInterface(psiModule, resolveContext);
if (disposableInterface == null)
return;
var graf = CSharpControlFlowBuilder.Build(functionDeclaration) as CSharpControlFlowGraf;
if (graf == null)
return;
var name = functionDeclaration.DeclaredName;
var offset = InvokedExpressionData.GetOffsetByNode(functionDeclaration);
var grafInspector = new ControlFlowInspector(functionDeclaration, graf, disposableInterface);
var methodArguments = grafInspector.GetMethodArgumentStatuses();
_statuses.Add(new DisposeMethodStatus(name, offset, methodArguments, sourceFile));
}
示例4: IsNinjectBindCall
private bool IsNinjectBindCall(ITreeNode element)
{
var invocationExpression = element as IInvocationExpression;
if (invocationExpression == null)
{
return false;
}
var resolve = invocationExpression.InvocationExpressionReference.Resolve().Result;
var method = resolve.DeclaredElement as IMethod;
if (method == null)
{
return false;
}
ITypeElement containingType = method.GetContainingType();
if (containingType == null)
{
return false;
}
if (bindingRootType == null)
{
bindingRootType = TypeFactory.CreateTypeByCLRName("Ninject.Syntax.IBindingRoot", element.GetPsiModule());
}
return containingType.IsDescendantOf(bindingRootType.GetTypeElement());
}
示例5: CreateDocCommentBlockNode
/// <summary>
/// Creates a DocCommentBlockNode with the text provided.
/// </summary>
/// <param name="element">
/// The element to create for.
/// </param>
/// <param name="text">
/// The text to use to create the doc.
/// </param>
/// <returns>
/// An IDocCommentBlockNode that has been created.
/// </returns>
public static IDocCommentBlockNode CreateDocCommentBlockNode(ITreeNode element, string text)
{
// Fix up the xml terminators to remove the extra space.
text = text.Replace(" />", "/>");
StringBuilder builder = new StringBuilder();
foreach (string line in text.Split('\n'))
{
string outputLine = line;
if (line.StartsWith(" "))
{
outputLine = line.Substring(1);
}
builder.Append("/// " + outputLine + Environment.NewLine);
}
builder.Append("void fec();");
IDocCommentBlockOwnerNode declaration =
(IDocCommentBlockOwnerNode)CSharpElementFactory.GetInstance(element.GetPsiModule()).CreateTypeMemberDeclaration(builder.ToString());
return declaration.GetDocCommentBlockNode();
}
示例6: CreateTypeByClrName
public static IDeclaredType CreateTypeByClrName(ITreeNode node, string containerClrTypeName)
{
return TypeFactory.CreateTypeByCLRName(containerClrTypeName, node.GetPsiModule());
}