use of org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall in project intellij-plugins by JetBrains.
the class GrCucumberStepDeclarationSearcher method findDeclarationsAt.
@Override
public void findDeclarationsAt(@NotNull PsiElement element, int offsetInElement, Consumer<PomTarget> consumer) {
PsiLanguageInjectionHost host = InjectedLanguageManager.getInstance(element.getProject()).getInjectionHost(element);
if (host != null) {
element = host;
}
if (element.getParent() instanceof GrLiteral) {
element = element.getParent();
}
if (element instanceof GrLiteral) {
//~literal
final PsiElement parent = element.getParent();
if (parent != null) {
//(~literal)
final PsiElement pparent = parent.getParent();
if (pparent != null) {
//When(~literal)
final PsiElement ppparent = pparent.getParent();
if (ppparent instanceof GrMethodCall && GrCucumberUtil.isStepDefinition(ppparent)) {
final GrMethodCall methodCall = (GrMethodCall) ppparent;
consumer.consume(GrStepDefinition.getStepDefinition(methodCall));
}
}
}
}
}
Aggregations