0efe1110a8cac4d8de0582a605c3b81e9cef8612
[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.psi.PsiDirectory;
6 import com.jetbrains.edu.learning.core.EduNames;
7 import com.jetbrains.edu.learning.courseFormat.Course;
8 import com.jetbrains.edu.learning.courseFormat.Lesson;
9 import org.jetbrains.annotations.NotNull;
10
11 public class CCLessonRenameHandler extends CCRenameHandler implements TitledHandler {
12   @Override
13   protected boolean isAvailable(String name) {
14     return name.contains(EduNames.LESSON);
15   }
16
17   @Override
18   protected void rename(@NotNull Project project, @NotNull Course course, @NotNull PsiDirectory directory) {
19     Lesson lesson = course.getLesson(directory.getName());
20     if (lesson != null) {
21       processRename(lesson, EduNames.LESSON, project);
22     }
23   }
24
25   @Override
26   public String getActionTitle() {
27     return "Rename lesson";
28   }
29 }