Search in sources :

Example 1 with CCTaskCreator

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

the class CCCreateTask 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) {
    CCTaskCreator creator = CCTaskCreator.INSTANCE.forLanguage(course.getLanguageById());
    if (creator != null) {
        return creator.createTask(project, item, view, parentDirectory, course);
    }
    final Ref<PsiDirectory> taskDirectory = new Ref<>();
    ApplicationManager.getApplication().runWriteAction(() -> {
        String taskDirName = EduNames.TASK + item.getIndex();
        taskDirectory.set(DirectoryUtil.createSubdirectories(taskDirName, parentDirectory, "\\/"));
        if (taskDirectory.get() != null) {
            CCUtils.createTaskContent(project, view, course, taskDirectory.get());
        }
    });
    return taskDirectory.get();
}
Also used : Ref(com.intellij.openapi.util.Ref) PsiDirectory(com.intellij.psi.PsiDirectory) CCTaskCreator(com.jetbrains.edu.coursecreator.creation.CCTaskCreator) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Ref (com.intellij.openapi.util.Ref)1 PsiDirectory (com.intellij.psi.PsiDirectory)1 CCTaskCreator (com.jetbrains.edu.coursecreator.creation.CCTaskCreator)1 Nullable (org.jetbrains.annotations.Nullable)1