0c3d5b4088ce3533e206dff38ecbe1c42bf795ef
[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.courseFormat.Task;
7 import com.jetbrains.edu.learning.navigation.StudyNavigator;
8 import icons.InteractiveLearningIcons;
9 import org.jetbrains.annotations.NotNull;
10
11 import javax.swing.*;
12
13 public class StudyPreviousStudyTaskAction extends StudyTaskNavigationAction {
14   public StudyPreviousStudyTaskAction() {
15     super("Previous Task (" + KeymapUtil.getShortcutText(new KeyboardShortcut(KeyStroke.getKeyStroke(SHORTCUT), null)) + ")", "Navigate to the previous task", InteractiveLearningIcons.Prev);
16   }
17
18   public static final String ACTION_ID = "PreviousTaskAction";
19   public static final String SHORTCUT = "ctrl pressed COMMA";
20
21   @Override
22   protected String getNavigationFinishedMessage() {
23     return "It's already the first task";
24   }
25
26   @Override
27   protected Task getTargetTask(@NotNull final Task sourceTask) {
28     return StudyNavigator.previousTask(sourceTask);
29   }
30 }