diff --git a/java/java-features-trainer/src/com/intellij/java/ift/JavaLearningCourse.kt b/java/java-features-trainer/src/com/intellij/java/ift/JavaLearningCourse.kt index 6d008e30189d..e55a546a7e39 100644 --- a/java/java-features-trainer/src/com/intellij/java/ift/JavaLearningCourse.kt +++ b/java/java-features-trainer/src/com/intellij/java/ift/JavaLearningCourse.kt @@ -1,6 +1,7 @@ // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.java.ift +import com.intellij.execution.actions.RunConfigurationsComboBoxAction import com.intellij.java.ift.lesson.assistance.JavaEditorCodingAssistanceLesson import com.intellij.java.ift.lesson.basic.JavaContextActionsLesson import com.intellij.java.ift.lesson.basic.JavaSelectLesson @@ -15,6 +16,7 @@ import com.intellij.java.ift.lesson.refactorings.JavaRenameLesson import com.intellij.java.ift.lesson.run.JavaDebugLesson import com.intellij.java.ift.lesson.run.JavaRunConfigurationLesson import com.intellij.lang.java.JavaLanguage +import com.intellij.openapi.project.ProjectManager import com.intellij.util.PlatformUtils import training.dsl.LessonUtil import training.learn.CourseManager @@ -141,17 +143,21 @@ class JavaLearningCourse : LearningCourseBase(JavaLanguage.INSTANCE.id) { JavaOccurrencesLesson(), ) }, - LearningModule(id = "Java.RunAndDebug", - name = LessonsBundle.message("run.debug.module.name"), - description = LessonsBundle.message("run.debug.module.description"), - primaryLanguage = langSupport, - moduleType = LessonType.SINGLE_EDITOR) { - listOf( - JavaRunConfigurationLesson(), - JavaDebugLesson(), - ) - }, - ) + ) + if (RunConfigurationsComboBoxAction.hasRunCurrentFileItem(ProjectManager.getInstance().defaultProject)) { // project doesn't matter in this check for us + listOf( + LearningModule(id = "Java.RunAndDebug", + name = LessonsBundle.message("run.debug.module.name"), + description = LessonsBundle.message("run.debug.module.description"), + primaryLanguage = langSupport, + moduleType = LessonType.SINGLE_EDITOR) { + listOf( + JavaRunConfigurationLesson(), + JavaDebugLesson(), + ) + } + ) + } + else emptyList() override fun getLessonIdToTipsMap(): Map> = mutableMapOf( // Essential diff --git a/python/python-features-trainer/src/com/intellij/python/featuresTrainer/ift/PythonLearningCourse.kt b/python/python-features-trainer/src/com/intellij/python/featuresTrainer/ift/PythonLearningCourse.kt index d7c969116856..f054cf93e777 100644 --- a/python/python-features-trainer/src/com/intellij/python/featuresTrainer/ift/PythonLearningCourse.kt +++ b/python/python-features-trainer/src/com/intellij/python/featuresTrainer/ift/PythonLearningCourse.kt @@ -1,8 +1,8 @@ // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.python.featuresTrainer.ift -import com.intellij.util.PlatformUtils -import com.jetbrains.python.PythonLanguage +import com.intellij.execution.actions.RunConfigurationsComboBoxAction +import com.intellij.openapi.project.ProjectManager import com.intellij.python.featuresTrainer.ift.lesson.assistance.PythonEditorCodingAssistanceLesson import com.intellij.python.featuresTrainer.ift.lesson.basic.PythonContextActionsLesson import com.intellij.python.featuresTrainer.ift.lesson.basic.PythonSelectLesson @@ -19,6 +19,8 @@ import com.intellij.python.featuresTrainer.ift.lesson.refactorings.PythonRefacto import com.intellij.python.featuresTrainer.ift.lesson.refactorings.PythonRenameLesson import com.intellij.python.featuresTrainer.ift.lesson.run.PythonDebugLesson import com.intellij.python.featuresTrainer.ift.lesson.run.PythonRunConfigurationLesson +import com.intellij.util.PlatformUtils +import com.jetbrains.python.PythonLanguage import training.dsl.LessonUtil import training.learn.CourseManager import training.learn.LessonsBundle @@ -125,17 +127,21 @@ class PythonLearningCourse : LearningCourseBase(PythonLanguage.INSTANCE.id) { PythonRecentFilesLesson(), ) }, - LearningModule(id = "Python.RunAndDebug", - name = LessonsBundle.message("run.debug.module.name"), - description = LessonsBundle.message("run.debug.module.description"), - primaryLanguage = langSupport, - moduleType = LessonType.SINGLE_EDITOR) { - listOf( - PythonRunConfigurationLesson(), - PythonDebugLesson(), - ) - }, - ) + ) + if (RunConfigurationsComboBoxAction.hasRunCurrentFileItem(ProjectManager.getInstance().defaultProject)) { // project doesn't matter in this check for us + listOf( + LearningModule(id = "Python.RunAndDebug", + name = LessonsBundle.message("run.debug.module.name"), + description = LessonsBundle.message("run.debug.module.description"), + primaryLanguage = langSupport, + moduleType = LessonType.SINGLE_EDITOR) { + listOf( + PythonRunConfigurationLesson(), + PythonDebugLesson(), + ) + } + ) + } + else emptyList() override fun getLessonIdToTipsMap(): Map> = mutableMapOf( // EditorBasics