Search in sources :

Example 16 with CourseInfo

use of com.jetbrains.edu.learning.courseFormat.CourseInfo 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

CourseInfo (com.jetbrains.edu.learning.courseFormat.CourseInfo)16 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 TaskFile (com.jetbrains.edu.learning.courseFormat.TaskFile)7 NewVirtualFile (com.intellij.openapi.vfs.newvfs.NewVirtualFile)5 PsiFile (com.intellij.psi.PsiFile)5 Course (com.jetbrains.edu.learning.courseFormat.Course)4 File (java.io.File)4 Project (com.intellij.openapi.project.Project)3 Lesson (com.jetbrains.edu.learning.courseFormat.Lesson)3 List (java.util.List)3 Nullable (org.jetbrains.annotations.Nullable)3 IdeView (com.intellij.ide.IdeView)2 Notification (com.intellij.notification.Notification)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 Task (com.intellij.openapi.progress.Task)2 AncestorListenerAdapter (com.intellij.ui.AncestorListenerAdapter)2 ArrayList (java.util.ArrayList)2 JsonReader (com.google.gson.stream.JsonReader)1 FacetValidatorsManager (com.intellij.facet.ui.FacetValidatorsManager)1 ValidationResult (com.intellij.facet.ui.ValidationResult)1