use of com.jetbrains.edu.learning.intellij.EduCourseConfigurator in project intellij-community by JetBrains.
the class EduCustomCourseModuleBuilder method createModule.
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module baseModule = super.createModule(moduleModel);
if (mySelectedCourse != null) {
String type = mySelectedCourse.getType();
String languageName = type.substring("pycharm ".length());
Language language = Language.findLanguageByID(languageName);
if (language != null) {
EduCourseConfigurator configurator = EduCourseConfigurator.INSTANCE.forLanguage(language);
if (configurator != null) {
configurator.createCourseFromCourseInfo(moduleModel, baseModule.getProject(), myGenerator, mySelectedCourse, getModuleFileDirectory());
}
}
}
return baseModule;
}
use of com.jetbrains.edu.learning.intellij.EduCourseConfigurator in project intellij-community by JetBrains.
the class EduCCModuleBuilder method createModule.
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module module = super.createModule(moduleModel);
Project project = module.getProject();
final Course course = new Course();
course.setName(myPanel.getName());
course.setAuthorsAsString(myPanel.getAuthors());
course.setDescription(myPanel.getDescription());
LanguageWrapper wrapper = (LanguageWrapper) myLanguageComboBox.getSelectedItem();
course.setLanguage(wrapper.getLanguage().getID());
course.setCourseMode(CCUtils.COURSE_MODE);
File courseDir = new File(StudyProjectGenerator.OUR_COURSES_DIR, myPanel.getName() + "-" + project.getName());
course.setCourseDirectory(courseDir.getPath());
Lesson lesson = new Lesson();
Task task = new Task();
task.setName("task1");
lesson.addTask(task);
lesson.setName("lesson1");
course.addLesson(lesson);
course.initCourse(false);
StudyTaskManager.getInstance(project).setCourse(course);
EduCourseConfigurator configurator = EduCourseConfigurator.INSTANCE.forLanguage(wrapper.getLanguage());
if (configurator == null) {
LOG.error("EduCourseConfigurator for language " + wrapper.getLanguage().getDisplayName() + " not found");
return module;
}
configurator.configureModule(module);
configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory());
return module;
}
use of com.jetbrains.edu.learning.intellij.EduCourseConfigurator in project intellij-community by JetBrains.
the class EduCustomCourseModuleBuilder method commitModule.
@Nullable
@Override
public Module commitModule(@NotNull Project project, @Nullable ModifiableModuleModel model) {
Module module = super.commitModule(project, model);
if (module == null) {
return null;
}
String type = mySelectedCourse.getType();
String languageName = type.substring("pycharm ".length());
Language language = Language.findLanguageByID(languageName);
if (language != null) {
EduCourseConfigurator configurator = EduCourseConfigurator.INSTANCE.forLanguage(language);
if (configurator != null) {
configurator.configureModule(module);
}
}
return module;
}
Aggregations