handle src dir inside task dir
[idea/community.git] / python / educational-core / course-creator / src / com / jetbrains / edu / coursecreator / handlers / CCLessonRenameHandler.java
1 package com.jetbrains.edu.coursecreator.handlers;
2
3 import com.intellij.ide.TitledHandler;
4 import com.intellij.openapi.project.Project;
5 import com.intellij.openapi.vfs.VirtualFile;
6 import com.intellij.psi.PsiDirectory;
7 import com.jetbrains.edu.learning.core.EduNames;
8 import com.jetbrains.edu.learning.courseFormat.Course;
9 import com.jetbrains.edu.learning.courseFormat.Lesson;
10 import org.jetbrains.annotations.NotNull;
11
12 public class CCLessonRenameHandler extends CCRenameHandler implements TitledHandler {
13   @Override
14   protected boolean isAvailable(VirtualFile dir) {
15     return dir.getName().contains(EduNames.LESSON);
16   }
17
18   @Override
19   protected void rename(@NotNull Project project, @NotNull Course course, @NotNull PsiDirectory directory) {
20     Lesson lesson = course.getLesson(directory.getName());
21     if (lesson != null) {
22       processRename(lesson, EduNames.LESSON, project);
23     }
24   }
25
26   @Override
27   public String getActionTitle() {
28     return "Rename lesson";
29   }
30 }