1 package com.jetbrains.edu.learning.actions;
3 import com.jetbrains.edu.courseFormat.AnswerPlaceholder;
4 import com.jetbrains.edu.learning.StudyUtils;
5 import icons.InteractiveLearningIcons;
6 import org.jetbrains.annotations.NotNull;
7 import org.jetbrains.annotations.Nullable;
15 public class StudyPrevWindowAction extends StudyWindowNavigationAction {
16 public static final String ACTION_ID = "PrevWindowAction";
17 public static final String SHORTCUT = "ctrl shift pressed COMMA";
19 public StudyPrevWindowAction() {
20 super("Navigate to the Previous Answer Placeholder", "Navigate to the previous answer placeholder", InteractiveLearningIcons.Prev);
26 protected AnswerPlaceholder getNextAnswerPlaceholder(@NotNull final AnswerPlaceholder window) {
27 int prevIndex = window.getIndex() - 1;
28 List<AnswerPlaceholder> windows = window.getTaskFile().getAnswerPlaceholders();
29 if (StudyUtils.indexIsValid(prevIndex, windows)) {
30 return windows.get(prevIndex);