in intellij-plugin/features/ai-hints-core/src/com/jetbrains/edu/aiHints/core/action/GetHint.kt [43:63]
override fun update(e: AnActionEvent) {
e.presentation.isEnabledAndVisible = false
if (!isFeatureEnabled(EduExperimentalFeatures.AI_HINTS)) return
val project = e.project ?: return
val course = project.course.asSafely<EduCourse>() ?: return
val task = project.getCurrentTask().asSafely<EduTask>() ?: return
// Action is not available for tasks with no functions in the Author's Solution
if (!task.isFunctionsPresented(project)) return
e.presentation.isEnabled =
course.isMarketplace && course.isStudy
&& task.status == CheckStatus.Failed
&& EduAIHintsProcessor.forCourse(course) != null
/**
* Even though the action is enabled, we make it invisible in case the user has accepted the Code Hint
* so to prevent them to perform an action again before the Check
*/
e.presentation.isVisible = e.presentation.isEnabled && HintStateManager.isDefault(project)
e.presentation.putClientProperty(PROJECT_KEY, project)
}