Fix #EDU-565 The shortcut for "check task" doesn't work
[idea/community.git] / python / educational-core / student / src / com / jetbrains / edu / learning / actions / StudyNextStudyTaskAction.java
1 package com.jetbrains.edu.learning.actions;
2
3 import com.intellij.icons.AllIcons;
4 import com.intellij.openapi.actionSystem.KeyboardShortcut;
5 import com.intellij.openapi.keymap.KeymapUtil;
6 import com.jetbrains.edu.courseFormat.Task;
7 import com.jetbrains.edu.learning.navigation.StudyNavigator;
8 import org.jetbrains.annotations.NotNull;
9
10 import javax.swing.*;
11
12 public class StudyNextStudyTaskAction extends StudyTaskNavigationAction {
13
14   public static final String ACTION_ID = "NextTaskAction";
15   public static final String SHORTCUT = "ctrl pressed PERIOD";
16
17   public StudyNextStudyTaskAction() {
18     super("Next Task (" + KeymapUtil.getShortcutText(new KeyboardShortcut(KeyStroke.getKeyStroke(SHORTCUT), null)) + ")", "Navigate to the next task", AllIcons.Actions.Forward);
19   }
20
21   @Override
22   protected String getNavigationFinishedMessage() {
23     return "It's the last task";
24   }
25
26   @Override
27   protected Task getTargetTask(@NotNull final Task sourceTask) {
28     return StudyNavigator.nextTask(sourceTask);
29   }
30
31   @Override
32   public String getActionId() {
33     return ACTION_ID;
34   }
35
36   @Override
37   public String[] getShortcuts() {
38     return new String[]{SHORTCUT};
39   }
40 }