Search in sources :

Example 1 with GrNamedArgumentsOwner

use of org.jetbrains.plugins.groovy.lang.psi.api.util.GrNamedArgumentsOwner in project intellij-community by JetBrains.

the class PsiUtil method getNamedArgumentValue.

@Nullable
public static PsiElement getNamedArgumentValue(GrNamedArgument otherNamedArgument, String argumentName) {
    PsiElement parent = otherNamedArgument.getParent();
    if (!(parent instanceof GrNamedArgumentsOwner))
        return null;
    GrNamedArgument namedArgument = ((GrNamedArgumentsOwner) parent).findNamedArgument(argumentName);
    if (namedArgument == null)
        return null;
    return namedArgument.getExpression();
}
Also used : GrNamedArgument(org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument) GrNamedArgumentsOwner(org.jetbrains.plugins.groovy.lang.psi.api.util.GrNamedArgumentsOwner) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Nullable (org.jetbrains.annotations.Nullable)1 GrNamedArgument (org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument)1 GrNamedArgumentsOwner (org.jetbrains.plugins.groovy.lang.psi.api.util.GrNamedArgumentsOwner)1