Search in sources :

Example 1 with StepModuleBuilder

use of org.stepik.plugin.projectWizard.idea.StepModuleBuilder in project intellij-plugins by StepicOrg.

the class ModuleUtils method createStepModule.

static void createStepModule(@NotNull Project project, @NotNull StepNode step, @NotNull ModifiableModuleModel moduleModel) {
    StudyNode lesson = step.getParent();
    if (lesson != null) {
        String moduleDir = String.join("/", project.getBasePath(), lesson.getPath());
        StepModuleBuilder stepModuleBuilder = new StepModuleBuilder(moduleDir, step);
        try {
            stepModuleBuilder.createModule(moduleModel);
        } catch (IOException | ModuleWithNameAlreadyExists | JDOMException | ConfigurationException e) {
            logger.warn("Cannot create step: " + step.getDirectory(), e);
        }
    }
}
Also used : ConfigurationException(com.intellij.openapi.options.ConfigurationException) ModuleWithNameAlreadyExists(com.intellij.openapi.module.ModuleWithNameAlreadyExists) IOException(java.io.IOException) JDOMException(org.jdom.JDOMException) StudyNode(org.stepik.core.courseFormat.StudyNode) StepModuleBuilder(org.stepik.plugin.projectWizard.idea.StepModuleBuilder)

Aggregations

ModuleWithNameAlreadyExists (com.intellij.openapi.module.ModuleWithNameAlreadyExists)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 IOException (java.io.IOException)1 JDOMException (org.jdom.JDOMException)1 StudyNode (org.stepik.core.courseFormat.StudyNode)1 StepModuleBuilder (org.stepik.plugin.projectWizard.idea.StepModuleBuilder)1