Fix #EDU-565 The shortcut for "check task" doesn't work
[idea/community.git] / python / educational-python / student-python / src / com / jetbrains / edu / learning / PyStudyInstructionPainter.java
1 package com.jetbrains.edu.learning;
2
3 import com.intellij.openapi.actionSystem.KeyboardShortcut;
4 import com.intellij.openapi.fileEditor.impl.EditorEmptyTextPainter;
5 import com.intellij.openapi.keymap.KeymapUtil;
6 import com.intellij.util.ui.UIUtil;
7 import com.jetbrains.edu.learning.actions.*;
8 import com.jetbrains.edu.learning.ui.StudyProgressToolWindowFactory;
9 import org.jetbrains.annotations.NotNull;
10
11 import javax.swing.*;
12
13 public class PyStudyInstructionPainter extends EditorEmptyTextPainter {
14   private static final String separator = " / ";
15   @Override
16   protected void advertiseActions(@NotNull JComponent splitters, @NotNull UIUtil.TextPainter painter) {
17     String shortcut = KeymapUtil.getShortcutText(new KeyboardShortcut(KeyStroke.getKeyStroke(StudyNextWindowAction.SHORTCUT2), null));
18     appendAction(painter, "Navigate to the next answer placeholder", shortcut);
19     appendAction(painter, "Navigate between answer placeholders", getActionShortcutText(StudyPrevWindowAction.ACTION_ID) + separator +
20                                                                   getActionShortcutText(StudyNextWindowAction.ACTION_ID));
21     appendAction(painter, "Navigate between tasks", getActionShortcutText(StudyPreviousStudyTaskAction.ACTION_ID) + separator +
22                                                     getActionShortcutText(StudyNextStudyTaskAction.ACTION_ID));
23     appendAction(painter, "Reset current task file", getActionShortcutText(StudyRefreshTaskFileAction.ACTION_ID));
24     appendAction(painter, "Check task", getActionShortcutText(PyStudyCheckAction.ACTION_ID));
25     appendAction(painter, "Get hint for the answer placeholder", getActionShortcutText(StudyShowHintAction.ACTION_ID));
26     appendLine(painter, "To see your progress open the '" + StudyProgressToolWindowFactory.ID + "' panel");
27   }
28 }