[IFT] Add balloon to run step in Java onboarding

IJ-CR-26892

GitOrigin-RevId: 2ac9a1d57a32d983c74e06cbea29478257a4bc85
This commit is contained in:
Konstantin Hudyakov
2022-07-07 10:30:29 +03:00
committed by intellij-monorepo-bot
parent 491cf0fcb0
commit 4eebad88d0
3 changed files with 15 additions and 4 deletions

View File

@@ -22,11 +22,12 @@ java.onboarding.balloon.open.learn.toolbar=Switch to the {0} tool window to cont
java.onboarding.indexing.description=When you open a project for the first time, <ide/> scans the JDK and the project itself \ java.onboarding.indexing.description=When you open a project for the first time, <ide/> scans the JDK and the project itself \
to collect details required for coding assistance. To continue, wait until indexing completes. to collect details required for coding assistance. To continue, wait until indexing completes.
java.onboarding.wait.indexing=Please wait while the IDE indexes JDK files java.onboarding.wait.indexing=Please wait while the IDE indexes JDK files
java.onboarding.temporary.configuration.description=You have opened the demo sample. Now, let''s run it! In the highlighted area of the toolbar, \ java.onboarding.temporary.configuration.description=You have opened the demo sample. Now, let's run it! In the highlighted area of the toolbar, \
you can see popular running actions for the selected configuration. you can see popular running actions for the selected configuration.
java.onboarding.run.options.community=For example, you can run your code {0}, debug it {1}, and run with coverage {2}. java.onboarding.run.options.community=For example, you can run your code {0}, debug it {1}, and run with coverage {2}.
java.onboarding.run.options.ultimate=For example, you can run your code {0}, debug it {1}, profile {2}, and run with coverage {3}. java.onboarding.run.options.ultimate=For example, you can run your code {0}, debug it {1}, profile {2}, and run with coverage {3}.
java.onboarding.run.sample=For now, let''s run the current file, click {0} or press {1}. java.onboarding.run.sample=For now, let''s run the current file, click {0} or press {1}.
java.onboarding.run.sample.balloon=Let''s run the current file, click {0} or press {1}.
java.onboarding.balloon.click.here=Click here to set a breakpoint java.onboarding.balloon.click.here=Click here to set a breakpoint
java.onboarding.toggle.breakpoint.1=You may notice that instead of the expected value of {0}, the {1} method returns {2}. \ java.onboarding.toggle.breakpoint.1=You may notice that instead of the expected value of {0}, the {1} method returns {2}. \
Let''s stop at the return statement to debug the problematic code. Let''s stop at the return statement to debug the problematic code.

View File

@@ -14,9 +14,11 @@ import com.intellij.ide.util.gotoByName.GotoActionModel
import com.intellij.idea.ActionsBundle import com.intellij.idea.ActionsBundle
import com.intellij.java.ift.JavaLessonsBundle import com.intellij.java.ift.JavaLessonsBundle
import com.intellij.java.ift.JavaProjectUtil import com.intellij.java.ift.JavaProjectUtil
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionPlaces import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.ex.ActionUtil import com.intellij.openapi.actionSystem.ex.ActionUtil
import com.intellij.openapi.actionSystem.impl.ActionButton
import com.intellij.openapi.application.invokeLater import com.intellij.openapi.application.invokeLater
import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.diagnostic.thisLogger import com.intellij.openapi.diagnostic.thisLogger
@@ -383,7 +385,13 @@ class JavaOnboardingTourLesson : KLesson("java.onboarding", JavaLessonsBundle.me
} }
private fun LessonContext.runTasks() { private fun LessonContext.runTasks() {
highlightRunToolbar() highlightRunToolbar(usePulsation = false)
task {
triggerUI {
clearPreviousHighlights = false
}.component { ui: ActionButton -> ActionManager.getInstance().getId(ui.action) == "Run" }
}
task { task {
val runOptionsText = if (PlatformUtils.isIdeaUltimate()) { val runOptionsText = if (PlatformUtils.isIdeaUltimate()) {
@@ -401,6 +409,8 @@ class JavaOnboardingTourLesson : KLesson("java.onboarding", JavaLessonsBundle.me
} }
text(JavaLessonsBundle.message("java.onboarding.temporary.configuration.description") + " $runOptionsText") text(JavaLessonsBundle.message("java.onboarding.temporary.configuration.description") + " $runOptionsText")
text(JavaLessonsBundle.message("java.onboarding.run.sample", icon(AllIcons.Actions.Execute), action("Run"))) text(JavaLessonsBundle.message("java.onboarding.run.sample", icon(AllIcons.Actions.Execute), action("Run")))
text(JavaLessonsBundle.message("java.onboarding.run.sample.balloon", icon(AllIcons.Actions.Execute), action("Run")),
LearningBalloonConfig(Balloon.Position.below, 0))
checkToolWindowState("Run", true) checkToolWindowState("Run", true)
restoreIfModified(sample) restoreIfModified(sample)
} }

View File

@@ -399,10 +399,10 @@ fun LessonContext.firstLessonCompletedMessage() {
text(LessonsBundle.message("goto.action.propose.to.go.next.new.ui", LessonUtil.rawEnter())) text(LessonsBundle.message("goto.action.propose.to.go.next.new.ui", LessonUtil.rawEnter()))
} }
fun LessonContext.highlightRunToolbar() { fun LessonContext.highlightRunToolbar(usePulsation: Boolean = true) {
task { task {
val stopAction = getActionById("Stop") val stopAction = getActionById("Stop")
triggerAndFullHighlight { usePulsation = true }.componentPart { ui: ActionToolbarImpl -> triggerAndFullHighlight { this.usePulsation = usePulsation }.componentPart { ui: ActionToolbarImpl ->
ui.takeIf { (ui.place == ActionPlaces.NAVIGATION_BAR_TOOLBAR || ui.place == ActionPlaces.MAIN_TOOLBAR) }?.let { ui.takeIf { (ui.place == ActionPlaces.NAVIGATION_BAR_TOOLBAR || ui.place == ActionPlaces.MAIN_TOOLBAR) }?.let {
val configurations = ui.components.find { it is JPanel && it.components.any { b -> b is ComboBoxAction.ComboBoxButton } } val configurations = ui.components.find { it is JPanel && it.components.any { b -> b is ComboBoxAction.ComboBoxButton } }
val stop = ui.components.find { it is ActionButton && it.action == stopAction } val stop = ui.components.find { it is ActionButton && it.action == stopAction }