Search in sources :

Example 1 with BDDFrameworkType

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

the class CucumberStepsIndex method isStepLikeFile.

private boolean isStepLikeFile(PsiElement child, PsiElement parent) {
    if (child instanceof PsiFile) {
        final PsiFile file = (PsiFile) child;
        CucumberJvmExtensionPoint ep = myExtensionMap.get(new BDDFrameworkType(file.getFileType()));
        return ep != null && ep.isStepLikeFile(file, parent);
    }
    return false;
}
Also used : CucumberJvmExtensionPoint(org.jetbrains.plugins.cucumber.CucumberJvmExtensionPoint) PsiFile(com.intellij.psi.PsiFile) BDDFrameworkType(org.jetbrains.plugins.cucumber.BDDFrameworkType)

Example 2 with BDDFrameworkType

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

the class CucumberStepsIndex method getStepDefinitionContainers.

public Set<Pair<PsiFile, BDDFrameworkType>> getStepDefinitionContainers(@NotNull final GherkinFile featureFile) {
    Set<Pair<PsiFile, BDDFrameworkType>> result = new HashSet<>();
    for (CucumberJvmExtensionPoint ep : myExtensionMap.values()) {
        // Skip if framework file creation support is optional
        if ((ep instanceof OptionalStepDefinitionExtensionPoint) && !((OptionalStepDefinitionExtensionPoint) ep).participateInStepDefinitionCreation(featureFile)) {
            continue;
        }
        final Collection<? extends PsiFile> psiFiles = ep.getStepDefinitionContainers(featureFile);
        final BDDFrameworkType frameworkType = ep.getStepFileType();
        for (final PsiFile psiFile : psiFiles) {
            result.add(Pair.create(psiFile, frameworkType));
        }
    }
    return result;
}
Also used : CucumberJvmExtensionPoint(org.jetbrains.plugins.cucumber.CucumberJvmExtensionPoint) BDDFrameworkType(org.jetbrains.plugins.cucumber.BDDFrameworkType) PsiFile(com.intellij.psi.PsiFile) OptionalStepDefinitionExtensionPoint(org.jetbrains.plugins.cucumber.OptionalStepDefinitionExtensionPoint) Pair(com.intellij.openapi.util.Pair)

Example 3 with BDDFrameworkType

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

the class CucumberStepsIndex method isWritableStepLikeFile.

private boolean isWritableStepLikeFile(PsiElement child, PsiElement parent) {
    if (child instanceof PsiFile) {
        final PsiFile file = (PsiFile) child;
        CucumberJvmExtensionPoint ep = myExtensionMap.get(new BDDFrameworkType(file.getFileType()));
        return ep != null && ep.isWritableStepLikeFile(file, parent);
    }
    return false;
}
Also used : CucumberJvmExtensionPoint(org.jetbrains.plugins.cucumber.CucumberJvmExtensionPoint) PsiFile(com.intellij.psi.PsiFile) BDDFrameworkType(org.jetbrains.plugins.cucumber.BDDFrameworkType)

Aggregations

PsiFile (com.intellij.psi.PsiFile)3 BDDFrameworkType (org.jetbrains.plugins.cucumber.BDDFrameworkType)3 CucumberJvmExtensionPoint (org.jetbrains.plugins.cucumber.CucumberJvmExtensionPoint)3 Pair (com.intellij.openapi.util.Pair)1 OptionalStepDefinitionExtensionPoint (org.jetbrains.plugins.cucumber.OptionalStepDefinitionExtensionPoint)1