1cd6548274f30d4092fd478c61c635045c0f3966
[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.learning.courseFormat.Task;
7 import com.jetbrains.edu.learning.navigation.StudyNavigator;
8 import org.jetbrains.annotations.NotNull;
9 import org.jetbrains.annotations.Nullable;
10
11 import javax.swing.*;
12
13 public class StudyNextStudyTaskAction extends StudyTaskNavigationAction {
14
15   public static final String ACTION_ID = "NextTaskAction";
16   public static final String SHORTCUT = "ctrl pressed PERIOD";
17
18   public StudyNextStudyTaskAction() {
19     super("Next Task (" + KeymapUtil.getShortcutText(new KeyboardShortcut(KeyStroke.getKeyStroke(SHORTCUT), null)) + ")", "Navigate to the next task", AllIcons.Actions.Forward);
20   }
21
22   @Override
23   protected String getNavigationFinishedMessage() {
24     return "It's the last task";
25   }
26
27   @Override
28   protected Task getTargetTask(@NotNull final Task sourceTask) {
29     return StudyNavigator.nextTask(sourceTask);
30   }
31
32   @NotNull
33   @Override
34   public String getActionId() {
35     return ACTION_ID;
36   }
37
38   @Nullable
39   @Override
40   public String[] getShortcuts() {
41     return new String[]{SHORTCUT};
42   }
43 }