EDU-83 Add shortcut text to the next/prev/check button tooltip

This commit is contained in:
Liana Bakradze
2014-10-22 15:15:14 +04:00
parent 22af9f28ca
commit b9507243ef
10 changed files with 27 additions and 12 deletions
@@ -54,6 +54,8 @@
description="Refresh current task"/>
<action id="WatchInputAction" class="com.jetbrains.python.edu.actions.StudyEditInputAction" text="WatchInputAction"
description="watch input"/>
<action id="ShowHintAction" class="com.jetbrains.python.edu.actions.StudyShowHintAction" text="Show hint"
description="Show hint"/>
<action id="StudyRunAction" class="com.jetbrains.python.edu.actions.StudyRunAction" text="StudyRunAction" description="run your code"/>
<action id="WelcomeScreen.PythonIntro" class="com.jetbrains.python.edu.actions.StudyIntroductionCourseAction" icon="StudyIcons.EducationalProjectType">
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
@@ -28,7 +28,10 @@ public class StudyInstructionPainter extends EditorEmptyTextPainter {
painter.appendLine("PyCharm Educational Edition").underlined(new JBColor(Gray._150, Gray._180));
painter.appendLine("Navigate to the next task window with Ctrl + Enter").smaller().withBullet();
painter.appendLine("Navigate between task windows with Ctrl + < and Ctrl + >").smaller().withBullet();
painter.appendLine("Navigate between task windows with Ctrl + Shift + < and Ctrl + Shift + >").smaller().withBullet();
painter.appendLine("Navigate between tasks with Ctrl + < and Ctrl + >").smaller().withBullet();
painter.appendLine("Reset current task file with Ctrl + Shift + X").smaller().withBullet();
painter.appendLine("Check task with Alt + Ctrl + Enter").smaller().withBullet();
painter.appendLine("Get hint for the task window using Ctrl + 7").smaller().withBullet();
painter.appendLine("To see your progress open the 'Course Description' panel").smaller().withBullet();
painter.draw(g, new PairFunction<Integer, Integer, Couple<Integer>>() {
@@ -20,9 +20,7 @@ import com.intellij.openapi.vfs.VirtualFileEvent;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.wm.*;
import com.intellij.util.xmlb.XmlSerializer;
import com.jetbrains.python.edu.actions.StudyNextWindowAction;
import com.jetbrains.python.edu.actions.StudyPrevWindowAction;
import com.jetbrains.python.edu.actions.StudyShowHintAction;
import com.jetbrains.python.edu.actions.*;
import com.jetbrains.python.edu.course.Course;
import com.jetbrains.python.edu.course.Lesson;
import com.jetbrains.python.edu.course.Task;
@@ -155,6 +153,10 @@ public class StudyTaskManager implements ProjectComponent, PersistentStateCompon
addShortcut(StudyPrevWindowAction.SHORTCUT, StudyPrevWindowAction.ACTION_ID);
addShortcut(StudyShowHintAction.SHORTCUT, StudyShowHintAction.ACTION_ID);
addShortcut(StudyNextWindowAction.SHORTCUT2, StudyNextWindowAction.ACTION_ID);
addShortcut(StudyCheckAction.SHORTCUT, StudyCheckAction.ACTION_ID);
addShortcut(StudyNextStudyTaskAction.SHORTCUT, StudyNextStudyTaskAction.ACTION_ID);
addShortcut(StudyPreviousStudyTaskAction.SHORTCUT, StudyPreviousStudyTaskAction.ACTION_ID);
addShortcut(StudyRefreshTaskFileAction.SHORTCUT, StudyRefreshTaskFileAction.ACTION_ID);
}
}
});
@@ -41,6 +41,8 @@ public class StudyCheckAction extends DumbAwareAction {
private static final Logger LOG = Logger.getInstance(StudyCheckAction.class.getName());
private static final String ANSWERS_POSTFIX = "_answers.py";
public static final String ACTION_ID = "CheckAction";
public static final String SHORTCUT = "ctrl alt pressed ENTER";
private static void flushWindows(@NotNull final Task task, @NotNull final VirtualFile taskDir) {
@@ -8,6 +8,9 @@ import javax.swing.*;
public class StudyNextStudyTaskAction extends StudyTaskNavigationAction {
public static final String ACTION_ID = "NextTaskAction";
public static final String SHORTCUT = "ctrl pressed PERIOD";
@Override
protected JButton getButton(@NotNull final StudyEditor selectedStudyEditor) {
return selectedStudyEditor.getNextTaskButton();
@@ -12,7 +12,7 @@ import java.util.List;
*/
public class StudyNextWindowAction extends StudyWindowNavigationAction {
public static final String ACTION_ID = "NextWindow";
public static final String SHORTCUT = "ctrl pressed PERIOD";
public static final String SHORTCUT = "ctrl shift pressed PERIOD";
public static final String SHORTCUT2 = "ctrl pressed ENTER";
public StudyNextWindowAction() {
@@ -14,7 +14,7 @@ import java.util.List;
*/
public class StudyPrevWindowAction extends StudyWindowNavigationAction {
public static final String ACTION_ID = "PrevWindowAction";
public static final String SHORTCUT = "ctrl pressed COMMA";
public static final String SHORTCUT = "ctrl shift pressed COMMA";
public StudyPrevWindowAction() {
super("PrevWindowAction", "Select previous window", StudyIcons.Prev);
@@ -9,6 +9,8 @@ import javax.swing.*;
public class StudyPreviousStudyTaskAction extends StudyTaskNavigationAction {
public static final String ACTION_ID = "PreviousTaskAction";
public static final String SHORTCUT = "ctrl pressed COMMA";
@Override
protected JButton getButton(@NotNull final StudyEditor selectedStudyEditor) {
return selectedStudyEditor.getPrevTaskButton();
@@ -28,6 +28,8 @@ import java.io.*;
public class StudyRefreshTaskFileAction extends DumbAwareAction {
private static final Logger LOG = Logger.getInstance(StudyRefreshTaskFileAction.class.getName());
public static final String ACTION_ID = "RefreshTaskAction";
public static final String SHORTCUT = "ctrl shift pressed X";
public static void refresh(final Project project) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@@ -66,7 +66,6 @@ public class StudyEditor implements TextEditor {
private JButton myRefreshButton;
private static final Map<Document, StudyDocumentListener> myDocumentListeners = new HashMap<Document, StudyDocumentListener>();
private final Project myProject;
private JButton myShowHintButton;
public JButton getCheckButton() {
return myCheckButton;
@@ -193,11 +192,11 @@ public class StudyEditor implements TextEditor {
}
private void initializeButtons(@NotNull final JPanel taskActionsPanel, @NotNull final TaskFile taskFile) {
myCheckButton = addButton(taskActionsPanel, "Check task", StudyIcons.Resolve);
myPrevTaskButton = addButton(taskActionsPanel, "Prev Task", StudyIcons.Prev);
myNextTaskButton = addButton(taskActionsPanel, "Next Task", AllIcons.Actions.Forward);
myRefreshButton = addButton(taskActionsPanel, "Start task again", AllIcons.Actions.Refresh);
myShowHintButton = addButton(taskActionsPanel, "Show hint", StudyIcons.ShowHint);
myCheckButton = addButton(taskActionsPanel, "Check task (Ctrl + Alt + Enter)", StudyIcons.Resolve);
myPrevTaskButton = addButton(taskActionsPanel, "Previous task (Ctrl + &lt;)", StudyIcons.Prev);
myNextTaskButton = addButton(taskActionsPanel, "Next task (Ctrl + >)", AllIcons.Actions.Forward);
myRefreshButton = addButton(taskActionsPanel, "Reset task file (Ctrl + Shift + X)", AllIcons.Actions.Refresh);
JButton myShowHintButton = addButton(taskActionsPanel, "Show hint for task window (Ctrl + 7)", StudyIcons.ShowHint);
if (!taskFile.getTask().getUserTests().isEmpty()) {
JButton runButton = addButton(taskActionsPanel, "Run", AllIcons.General.Run);
runButton.addActionListener(new ActionListener() {