use of org.jetbrains.plugins.cucumber.inspections.ui.CreateStepDefinitionFileDialog in project intellij-plugins by JetBrains.
the class CucumberCreateStepFixBase method askUserForFilePath.
@Nullable
private static CreateStepDefinitionFileModel askUserForFilePath(@NotNull final GherkinStep step) {
final InputValidator validator = new InputValidator() {
public boolean checkInput(final String filePath) {
return !StringUtil.isEmpty(filePath);
}
public boolean canClose(final String fileName) {
return true;
}
};
Map<BDDFrameworkType, String> supportedFileTypesAndDefaultFileNames = new HashMap<>();
Map<BDDFrameworkType, PsiDirectory> fileTypeToDefaultDirectoryMap = new HashMap<>();
for (CucumberJvmExtensionPoint e : Extensions.getExtensions(CucumberJvmExtensionPoint.EP_NAME)) {
if (e instanceof OptionalStepDefinitionExtensionPoint) {
// Skip if framework file creation support is optional
if (!((OptionalStepDefinitionExtensionPoint) e).participateInStepDefinitionCreation(step)) {
continue;
}
}
supportedFileTypesAndDefaultFileNames.put(e.getStepFileType(), e.getStepDefinitionCreator().getDefaultStepFileName(step));
fileTypeToDefaultDirectoryMap.put(e.getStepFileType(), e.getStepDefinitionCreator().getDefaultStepDefinitionFolder(step));
}
CreateStepDefinitionFileModel model = new CreateStepDefinitionFileModel(step.getProject(), supportedFileTypesAndDefaultFileNames, fileTypeToDefaultDirectoryMap);
CreateStepDefinitionFileDialog createStepDefinitionFileDialog = new CreateStepDefinitionFileDialog(step.getProject(), model, validator);
if (createStepDefinitionFileDialog.showAndGet()) {
return model;
} else {
return null;
}
}
Aggregations