EDU-661 Adaptive Courses: disable Show hint button in Task view's toolbar
authorValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Fri, 29 Jul 2016 14:02:26 +0000 (17:02 +0300)
committerValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Fri, 29 Jul 2016 15:07:27 +0000 (18:07 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/actions/StudyShowHintAction.java

index de89ba659f77650f8fe85df0da4b6559630e06cf..d1ee72a8585e104d89868c934fb15d244272b52f 100644 (file)
@@ -87,6 +87,15 @@ public class StudyShowHintAction extends StudyActionWithShortcut {
 
   @Override
   public void update(@NotNull AnActionEvent e) {
+    final Project project = e.getProject();
+    if (project != null) {
+      final Course course = StudyTaskManager.getInstance(project).getCourse();
+      if (course != null && course.isAdaptive()) {
+        e.getPresentation().setEnabled(false);
+        return;
+      }
+    }
+    
     StudyUtils.updateAction(e);
   }