Search in sources :

Example 1 with CCLessonCreator

use of com.jetbrains.edu.coursecreator.creation.CCLessonCreator in project intellij-community by JetBrains.

the class CCCreateLesson method createItemDir.

@Override
@Nullable
protected PsiDirectory createItemDir(@NotNull final Project project, @NotNull final StudyItem item, @Nullable final IdeView view, @NotNull final PsiDirectory parentDirectory, @NotNull final Course course) {
    CCLessonCreator creator = CCLessonCreator.INSTANCE.forLanguage(course.getLanguageById());
    if (creator != null) {
        return creator.createLesson(project, item, view, parentDirectory, course);
    }
    final PsiDirectory[] lessonDirectory = new PsiDirectory[1];
    ApplicationManager.getApplication().runWriteAction(() -> {
        lessonDirectory[0] = DirectoryUtil.createSubdirectories(EduNames.LESSON + item.getIndex(), parentDirectory, "\\/");
    });
    if (lessonDirectory[0] != null) {
        if (view != null) {
            view.selectElement(lessonDirectory[0]);
        }
    }
    return lessonDirectory[0];
}
Also used : PsiDirectory(com.intellij.psi.PsiDirectory) CCLessonCreator(com.jetbrains.edu.coursecreator.creation.CCLessonCreator) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

PsiDirectory (com.intellij.psi.PsiDirectory)1 CCLessonCreator (com.jetbrains.edu.coursecreator.creation.CCLessonCreator)1 Nullable (org.jetbrains.annotations.Nullable)1