1b711f818b90c6dd91a02a2d3b7daa49eb1274d4
[idea/community.git] / python / edu / course-creator-python / src / com / jetbrains / edu / coursecreator / PyStudyLanguageManager.java
1 package com.jetbrains.edu.coursecreator;
2
3 import com.intellij.ide.fileTemplates.FileTemplate;
4 import com.intellij.ide.fileTemplates.FileTemplateManager;
5 import com.intellij.openapi.project.Project;
6 import org.jetbrains.annotations.NotNull;
7 import org.jetbrains.annotations.Nullable;
8
9 public class PyStudyLanguageManager implements StudyLanguageManager {
10   @Nullable
11   @Override
12   public String getDefaultTaskFileExtension() {
13     return "py";
14   }
15
16   @Nullable
17   @Override
18   public FileTemplate getTaskFileTemplateForExtension(@NotNull final Project project, String extension) {
19     if (!extension.equals("py")) {
20       return null;
21     }
22     return getInternalTemplateByName(project, "task.answer.py");
23   }
24
25   @Nullable
26   @Override
27   public FileTemplate getTestsTemplate(@NotNull final Project project) {
28     return getInternalTemplateByName(project, "tests.py");
29   }
30
31   private static FileTemplate getInternalTemplateByName(@NotNull final Project project, String name) {
32     return FileTemplateManager.getInstance(project).getInternalTemplate(name);
33   }
34 }