653f00fd4b7d0ac94c003f70d72a5626ee0e8065
[idea/community.git] / python / educational-core / student / src / com / jetbrains / edu / learning / actions / StudyPreviousStudyTaskAction.java
1 package com.jetbrains.edu.learning.actions;
2
3
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 icons.InteractiveLearningIcons;
9 import org.jetbrains.annotations.NotNull;
10 import org.jetbrains.annotations.Nullable;
11
12 import javax.swing.*;
13
14 public class StudyPreviousStudyTaskAction extends StudyTaskNavigationAction {
15   public StudyPreviousStudyTaskAction() {
16     super("Previous Task (" + KeymapUtil.getShortcutText(new KeyboardShortcut(KeyStroke.getKeyStroke(SHORTCUT), null)) + ")", "Navigate to the previous task", InteractiveLearningIcons.Prev);
17   }
18
19   public static final String ACTION_ID = "PreviousTaskAction";
20   public static final String SHORTCUT = "ctrl pressed COMMA";
21
22   @Override
23   protected String getNavigationFinishedMessage() {
24     return "It's already the first task";
25   }
26
27   @Override
28   protected Task getTargetTask(@NotNull final Task sourceTask) {
29     return StudyNavigator.previousTask(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 }