summaryrefslogtreecommitdiff
path: root/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextWindowAction.java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-08-20 17:28:18 -0700
committerTor Norbye <tnorbye@google.com>2014-08-20 17:28:18 -0700
commitd76e3920c56d37c942092b7dca20fcaded81c0a5 (patch)
tree80a55c7b59c38377216daaada4e8bc47b69ceb9a /python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextWindowAction.java
parent3b37877a2561bf9fbe072253a18688807d523505 (diff)
parent1aa2e09bdbd413eacb677e9fa4b50630530d0656 (diff)
downloadidea-d76e3920c56d37c942092b7dca20fcaded81c0a5.tar.gz
Merge remote-tracking branch 'aosp/upstream-master' into merge
Conflicts: .idea/modules.xml platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdatesXmlLoader.java Change-Id: Id899dae9a1e1c79272f8a70e14a7dcef4f760d7f
Diffstat (limited to 'python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextWindowAction.java')
-rw-r--r--python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextWindowAction.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextWindowAction.java b/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextWindowAction.java
new file mode 100644
index 000000000000..595aeeff42e3
--- /dev/null
+++ b/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextWindowAction.java
@@ -0,0 +1,32 @@
+package com.jetbrains.python.edu.actions;
+
+import com.jetbrains.python.edu.StudyUtils;
+import com.jetbrains.python.edu.course.TaskWindow;
+import icons.StudyIcons;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+/**
+ * move caret to next task window
+ */
+public class StudyNextWindowAction extends StudyWindowNavigationAction {
+ public static final String ACTION_ID = "NextWindow";
+ public static final String SHORTCUT = "ctrl pressed PERIOD";
+ public static final String SHORTCUT2 = "ctrl pressed ENTER";
+
+ public StudyNextWindowAction() {
+ super("NextWindowAction", "Select next window", StudyIcons.Next);
+ }
+
+ @Override
+ protected TaskWindow getNextTaskWindow(@NotNull final TaskWindow window) {
+ int index = window.getIndex();
+ List<TaskWindow> windows = window.getTaskFile().getTaskWindows();
+ if (StudyUtils.indexIsValid(index, windows)) {
+ int newIndex = index + 1;
+ return newIndex == windows.size() ? windows.get(0) : windows.get(newIndex);
+ }
+ return null;
+ }
+}