Search in sources :

Example 1 with GherkinScenarioOutline

use of org.jetbrains.plugins.cucumber.psi.GherkinScenarioOutline in project intellij-plugins by JetBrains.

the class GherkinInplaceRenamer method finish.

@Override
public void finish(boolean success) {
    super.finish(success);
    if (success) {
        final PsiNamedElement newVariable = getVariable();
        if (newVariable != null) {
            final GherkinScenarioOutline scenario = PsiTreeUtil.getParentOfType(newVariable, GherkinScenarioOutline.class);
            if (scenario != null) {
                final CodeStyleManager csManager = CodeStyleManager.getInstance(newVariable.getProject());
                csManager.reformat(scenario);
            }
        }
    }
}
Also used : CodeStyleManager(com.intellij.psi.codeStyle.CodeStyleManager) PsiNamedElement(com.intellij.psi.PsiNamedElement) GherkinScenarioOutline(org.jetbrains.plugins.cucumber.psi.GherkinScenarioOutline)

Example 2 with GherkinScenarioOutline

use of org.jetbrains.plugins.cucumber.psi.GherkinScenarioOutline in project intellij-plugins by JetBrains.

the class CucumberMissedExamplesInspection method buildVisitor.

@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
    return new GherkinElementVisitor() {

        @Override
        public void visitScenarioOutline(GherkinScenarioOutline outline) {
            super.visitScenarioOutline(outline);
            final GherkinExamplesBlockImpl block = PsiTreeUtil.getChildOfType(outline, GherkinExamplesBlockImpl.class);
            if (block == null) {
                ASTNode[] keyword = outline.getNode().getChildren(GherkinTokenTypes.KEYWORDS);
                if (keyword.length > 0) {
                    holder.registerProblem(outline, keyword[0].getTextRange().shiftRight(-outline.getTextOffset()), CucumberBundle.message("inspection.missed.example.msg.name"), new CucumberCreateExamplesSectionFix());
                }
            }
        }
    };
}
Also used : GherkinExamplesBlockImpl(org.jetbrains.plugins.cucumber.psi.impl.GherkinExamplesBlockImpl) ASTNode(com.intellij.lang.ASTNode) GherkinElementVisitor(org.jetbrains.plugins.cucumber.psi.GherkinElementVisitor) GherkinScenarioOutline(org.jetbrains.plugins.cucumber.psi.GherkinScenarioOutline) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GherkinScenarioOutline (org.jetbrains.plugins.cucumber.psi.GherkinScenarioOutline)2 ASTNode (com.intellij.lang.ASTNode)1 PsiNamedElement (com.intellij.psi.PsiNamedElement)1 CodeStyleManager (com.intellij.psi.codeStyle.CodeStyleManager)1 NotNull (org.jetbrains.annotations.NotNull)1 GherkinElementVisitor (org.jetbrains.plugins.cucumber.psi.GherkinElementVisitor)1 GherkinExamplesBlockImpl (org.jetbrains.plugins.cucumber.psi.impl.GherkinExamplesBlockImpl)1