use of org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameterListOwner in project intellij-community by JetBrains.
the class GrDocParameterReferenceImpl method multiResolve.
@Override
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
final String name = getName();
if (name == null)
return ResolveResult.EMPTY_ARRAY;
ArrayList<GroovyResolveResult> candidates = new ArrayList<>();
final PsiElement owner = GrDocCommentUtil.findDocOwner(this);
if (owner instanceof GrMethod) {
final GrMethod method = (GrMethod) owner;
final GrParameter[] parameters = method.getParameters();
for (GrParameter parameter : parameters) {
if (name.equals(parameter.getName())) {
candidates.add(new GroovyResolveResultImpl(parameter, true));
}
}
return candidates.toArray(new ResolveResult[candidates.size()]);
} else {
final PsiElement firstChild = getFirstChild();
if (owner instanceof GrTypeParameterListOwner && firstChild != null) {
final ASTNode node = firstChild.getNode();
if (node != null && GroovyDocTokenTypes.mGDOC_TAG_VALUE_LT.equals(node.getElementType())) {
final PsiTypeParameter[] typeParameters = ((PsiTypeParameterListOwner) owner).getTypeParameters();
for (PsiTypeParameter typeParameter : typeParameters) {
if (name.equals(typeParameter.getName())) {
candidates.add(new GroovyResolveResultImpl(typeParameter, true));
}
}
}
}
}
return ResolveResult.EMPTY_ARRAY;
}
use of org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameterListOwner in project intellij-community by JetBrains.
the class GrDocParameterReferenceImpl method getVariants.
@Override
@NotNull
public Object[] getVariants() {
final PsiElement owner = GrDocCommentUtil.findDocOwner(this);
final PsiElement firstChild = getFirstChild();
if (owner instanceof GrTypeParameterListOwner && firstChild != null) {
final ASTNode node = firstChild.getNode();
if (node != null && GroovyDocTokenTypes.mGDOC_TAG_VALUE_LT.equals(node.getElementType())) {
return ((PsiTypeParameterListOwner) owner).getTypeParameters();
}
}
if (owner instanceof PsiMethod) {
return ((PsiMethod) owner).getParameterList().getParameters();
}
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
Aggregations