final PsiElement parent = step.getParent();
if (parent instanceof GherkinStepsHolder) {
final PsiReference[] references = step.getReferences();
if (references.length != 1 || !(references[0] instanceof CucumberStepReference)) return;
CucumberStepReference reference = (CucumberStepReference)references[0];
final AbstractStepDefinition definition = reference.resolveToDefinition();
if (definition == null) {
CucumberCreateStepFix createStepFix = null;
CucumberCreateAllStepsFix createAllStepsFix = null;
if (CucumberStepsIndex.getInstance(step.getProject()).getExtensionCount() > 0) {
createStepFix = new CucumberCreateStepFix();
createAllStepsFix = new CucumberCreateAllStepsFix();
}
holder.registerProblem(reference.getElement(), reference.getRangeInElement(),
CucumberBundle.message("cucumber.inspection.undefined.step.msg.name") + " #loc #ref",
createStepFix, createAllStepsFix);
}
else if (isOnTheFly) {
// highlighting for regexp params
final List<TextRange> parameterRanges = GherkinPsiUtil.buildParameterRanges(step, definition,
reference.getRangeInElement().getStartOffset());
if (parameterRanges == null) return;
for (TextRange range : parameterRanges) {
if (range.getLength() > 0) {
registerHighlighting(GherkinHighlighter.REGEXP_PARAMETER, step, range, holder);
}