Search in sources :

Example 1 with PythonGenerateProjectCallback

use of com.jetbrains.python.newProject.steps.PythonGenerateProjectCallback in project intellij-community by JetBrains.

the class PyStudyIntroductionCourseAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    final File projectDir = new File(ProjectUtil.getBaseDir(), INTRODUCTION_FOLDER);
    if (projectDir.exists()) {
        ProjectUtil.openProject(projectDir.getPath(), null, false);
    } else {
        final PyStudyDirectoryProjectGenerator generator = new PyStudyDirectoryProjectGenerator();
        CourseInfo introCourse = StudyProjectGenerator.getBundledIntro();
        if (introCourse == null) {
            return;
        }
        final PythonGenerateProjectCallback callback = new PythonGenerateProjectCallback();
        final ProjectSpecificSettingsStep step = new ProjectSpecificSettingsStep(generator, callback);
        // initialize panel to set location
        step.createPanel();
        step.setLocation(projectDir.toString());
        generator.setSelectedCourse(introCourse);
        callback.consume(step);
    }
}
Also used : PyStudyDirectoryProjectGenerator(com.jetbrains.edu.learning.PyStudyDirectoryProjectGenerator) PythonGenerateProjectCallback(com.jetbrains.python.newProject.steps.PythonGenerateProjectCallback) File(java.io.File) CourseInfo(com.jetbrains.edu.learning.courseFormat.CourseInfo) ProjectSpecificSettingsStep(com.jetbrains.python.newProject.steps.ProjectSpecificSettingsStep)

Aggregations

PyStudyDirectoryProjectGenerator (com.jetbrains.edu.learning.PyStudyDirectoryProjectGenerator)1 CourseInfo (com.jetbrains.edu.learning.courseFormat.CourseInfo)1 ProjectSpecificSettingsStep (com.jetbrains.python.newProject.steps.ProjectSpecificSettingsStep)1 PythonGenerateProjectCallback (com.jetbrains.python.newProject.steps.PythonGenerateProjectCallback)1 File (java.io.File)1