From 01e1b8e689d8df1ba4a8763178a197dce6c27894 Mon Sep 17 00:00:00 2001 From: Liana Bakradze Date: Tue, 21 Oct 2014 17:34:33 +0400 Subject: [PATCH] EDU-230 Move show hint action to editor --- .../edu/learn-python/gen/icons/StudyIcons.java | 2 +- .../learn-python/resources/META-INF/plugin.xml | 5 ----- .../com/jetbrains/python/edu/showHint.png | Bin 1218 -> 410 bytes .../com/jetbrains/python/edu/showHint@2x.png | Bin 0 -> 871 bytes .../edu/actions/StudyShowHintAction.java | 6 +++++- .../python/edu/editor/StudyEditor.java | 13 ++++++++++--- 6 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 python/edu/learn-python/resources/icons/com/jetbrains/python/edu/showHint@2x.png diff --git a/python/edu/learn-python/gen/icons/StudyIcons.java b/python/edu/learn-python/gen/icons/StudyIcons.java index d5a48ba4adfb..477e5ed54364 100644 --- a/python/edu/learn-python/gen/icons/StudyIcons.java +++ b/python/edu/learn-python/gen/icons/StudyIcons.java @@ -19,7 +19,7 @@ public class StudyIcons { public static final Icon Prev = load("/icons/com/jetbrains/python/edu/prev.png"); // 16x16 public static final Icon Resolve = load("/icons/com/jetbrains/python/edu/resolve.png"); // 16x16 public static final Icon Sandbox = load("/icons/com/jetbrains/python/edu/Sandbox.png"); // 16x16 - public static final Icon ShowHint = load("/icons/com/jetbrains/python/edu/showHint.png"); // 24x24 + public static final Icon ShowHint = load("/icons/com/jetbrains/python/edu/showHint.png"); // 16x16 public static final Icon Task = load("/icons/com/jetbrains/python/edu/Task.png"); // 16x16 public static final Icon TaskCompl = load("/icons/com/jetbrains/python/edu/TaskCompl.png"); // 16x16 public static final Icon TaskProbl = load("/icons/com/jetbrains/python/edu/TaskProbl.png"); // 16x16 diff --git a/python/edu/learn-python/resources/META-INF/plugin.xml b/python/edu/learn-python/resources/META-INF/plugin.xml index 388da68ae665..59457f3a1a95 100644 --- a/python/edu/learn-python/resources/META-INF/plugin.xml +++ b/python/edu/learn-python/resources/META-INF/plugin.xml @@ -55,11 +55,6 @@ - - - - diff --git a/python/edu/learn-python/resources/icons/com/jetbrains/python/edu/showHint.png b/python/edu/learn-python/resources/icons/com/jetbrains/python/edu/showHint.png index f10fd560464a494e76fac3b239a6d597d5264933..e3d4abf91fe9cd0d2a5851ae9461e7f4952b143a 100644 GIT binary patch literal 410 zcmV;L0cHM)P)|k<1xiozek3S5b&@b3cc(`$k`j>@(MHLUB-X*$XG`f0?1mF ztZgOvsz=DqGSKM+Ir(YsF+&#k4gk1Y>1lr6=_5Ncz^)vlvN6UzW-Mz7e2D-+nx;`L z@jM8?O5a)*sBQoWR5xIaY2%kx{{om~vVC8MpQ;7;0%VBF&=2lo&j0`b07*qoM6N<$ Ef>uGang9R* literal 1218 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbQ|Pftew|C&U%Vz0zoTy~XBuqTH=+ z$9L;u-mQ*$KG*N#=D5!rqu;L%Z)j+^TxWK*(ei4e6&P7wtTw*hY;&X4_GYKUtuCiq z-A)%u4S-xQL;q&G-Q5Z9cPF@AZ?(BM(fv-J%d>@{K=gQaz}xi+K=S3X$TzEF-mH%P zyd&-Piil6!l3yZ_p8n%>?yswLAGf9cIFk13YSW*mvwvNw`+c|f&$BtduGIf|Huu-HW?&%vIF$Ya zq^t7ZrwxA|PWy2z``3l)A4fC39Z3IvAocr^tiP|9{l3-v{XojMJ!#+erF`3$`r};9 zubVyJ4`+YfneuIS^0z%HKTekZy4wDANAlO5Nndv*{k+ujWqab6?FrvcR(;tT|8;Bp z_rrxiFaQ7l9~k4K03HI-Z{5EEIq@Yye!*}-AcIB4#?zKjzxCjY-%Nq$nVcRz6x!tZ z{8{0jg1XAoZ}t!D`8M&nJbKJp__aiO?;dH!)FY=)ol0i3pS^6UamUmtz8iKp%vs*( z^N1~Y)2qLKo=e$z+00iwrOCj+DCFtl7*cVobkasI7DIuy=kq16g&xcnv9{)(@9=@K z<+X@>er==nlOt{)SasI&Z4|cV7VNfue_(G++NP81n(7sVpPhf=-PRCufRDjRT1;_C z&v~1s&Zd{yu{<}~&sjfK{7{{3Y5pxmM=i~+Zs|{}aGAuM-@Y54+3h*nYQ-dVu#iRi z5s$fwl>gMe_5qressOG;AgLiA9?dSBLk}i9BX#aWLv%yKs-Yn70 T|AHObKoQ{S>gTe~DWM4fPuKP3 diff --git a/python/edu/learn-python/resources/icons/com/jetbrains/python/edu/showHint@2x.png b/python/edu/learn-python/resources/icons/com/jetbrains/python/edu/showHint@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..1d79e73b99ed3806f0834f91bcd9340810427494 GIT binary patch literal 871 zcmV-t1DO1YP)qs`)-{g~hynr0zg#uWkh8|`x3k_?H@Yqs-snY#BX0FE#&)-j^ z)fVOE#@O`jpTP`f4J{c2Ej-{QJHT|=!T7m53AFMoiw*gSNBK#|f`n(GffgR{k{v)- zexzDoqae#5j(5{k7Oa659_&>mJHY(C#LvdoJhHwjB-`tPEdeb&;3Yf2Le(joshf>P zfQraDK+ZXhum)J87O1}YyMW*UFWCW>>lAKF-#M}ks{|bH)Z{YMlJkp3z_nUW_K70q zBDstWV%=?QB*$d2sDlT4k?a75#B?G#${IE}!2}tYSdDcD%`8qb#pW10^Q)87>}GPf)Ju#Q|1kk&EF8bwH-WWE9PkCUR;oB0C-A$-^vIxirtW0p0$ z!WO`bTCF}245B6+0ZK|rypT-79w6uw@Xr4~fq(7<+%h)*z8wJuWds=5jsVfjSP+|! xd1k}^5;BoYGSkPHd^TNXx;(weu)c)b%?~VJR7>W<8bSa7002ovPDHLkV1lQloy`CM literal 0 HcmV?d00001 diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyShowHintAction.java b/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyShowHintAction.java index 0568a406759b..a464996d877a 100644 --- a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyShowHintAction.java +++ b/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyShowHintAction.java @@ -32,11 +32,15 @@ public class StudyShowHintAction extends DumbAwareAction { super("Show hint", "Show hint", StudyIcons.ShowHint); } - public void actionPerformed(AnActionEvent e) { + public void actionPerformed(@NotNull AnActionEvent e) { final Project project = e.getProject(); if (project == null) { return; } + showHint(project); + } + + public static void showHint(Project project) { Course course = StudyTaskManager.getInstance(project).getCourse(); if (course == null) { return; diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyEditor.java b/python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyEditor.java index 1a06e7ade6ab..a85df6c4cf14 100644 --- a/python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyEditor.java +++ b/python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyEditor.java @@ -66,6 +66,7 @@ public class StudyEditor implements TextEditor { private JButton myRefreshButton; private static final Map myDocumentListeners = new HashMap(); private final Project myProject; + private JButton myShowHintButton; public JButton getCheckButton() { return myCheckButton; @@ -196,6 +197,7 @@ public class StudyEditor implements TextEditor { 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); if (!taskFile.getTask().getUserTests().isEmpty()) { JButton runButton = addButton(taskActionsPanel, "Run", AllIcons.General.Run); runButton.addActionListener(new ActionListener() { @@ -242,9 +244,14 @@ public class StudyEditor implements TextEditor { myRefreshButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - StudyRefreshTaskFileAction studyRefreshTaskAction = - (StudyRefreshTaskFileAction)ActionManager.getInstance().getAction("RefreshTaskAction"); - studyRefreshTaskAction.refresh(myProject); + StudyRefreshTaskFileAction.refresh(myProject); + } + }); + + myShowHintButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + StudyShowHintAction.showHint(myProject); } }); }