[IFT] Adapt IDEA and PyCharm onboarding lessons to new UI

GitOrigin-RevId: 3e1194fff5e155a3649cd3484d2338c92edf99be
This commit is contained in:
Konstantin Hudyakov
2023-01-30 09:22:40 +00:00
committed by intellij-monorepo-bot
parent 02dac8c264
commit 85bb873c52
5 changed files with 53 additions and 59 deletions
@@ -22,12 +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 \
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.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.
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.temporary.configuration.description=You have opened the demo sample. Now, let''s run it! In the highlighted {0}, \
you can see popular running actions for the selected configuration. For example, you can run your code {1} or debug it {2}.
java.onboarding.run.options.community=Other actions like run with coverage {0} can be showed by clicking on {1}.
java.onboarding.run.options.ultimate=Other actions like profile {0}, and run with coverage {1} can be showed by clicking on {2}.
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.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.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.
@@ -41,13 +41,14 @@ import com.intellij.openapi.util.NlsSafe
import com.intellij.openapi.util.WindowStateService
import com.intellij.openapi.wm.ToolWindowManager
import com.intellij.openapi.wm.impl.FocusManagerImpl
import com.intellij.toolWindow.StripeButton
import com.intellij.ui.IdeUICustomization
import com.intellij.ui.UIBundle
import com.intellij.ui.components.fields.ExtendableTextField
import com.intellij.ui.components.panels.NonOpaquePanel
import com.intellij.ui.dsl.builder.Panel
import com.intellij.ui.tree.TreeVisitor
import com.intellij.util.PlatformUtils
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
import com.intellij.util.ui.tree.TreeUtil
import com.intellij.xdebugger.XDebuggerManager
@@ -321,7 +322,7 @@ class JavaOnboardingTourLesson : KLesson("java.onboarding", JavaLessonsBundle.me
toggleBreakpointTask(sample, { logicalPosition }, checkLine = false) {
text(JavaLessonsBundle.message("java.onboarding.balloon.click.here"),
LearningBalloonConfig(Balloon.Position.below, width = 0, duplicateMessage = false))
LearningBalloonConfig(Balloon.Position.below, width = 0, cornerToPointerDistance = JBUI.scale(20)))
text(JavaLessonsBundle.message("java.onboarding.toggle.breakpoint.1",
code("6.5"), code("findAverage"), code("26")))
text(JavaLessonsBundle.message("java.onboarding.toggle.breakpoint.2"))
@@ -342,7 +343,7 @@ class JavaOnboardingTourLesson : KLesson("java.onboarding", JavaLessonsBundle.me
task {
rehighlightPreviousUi = true
gotItStep(Balloon.Position.above, 400,
gotItStep(Balloon.Position.above, width = 0,
JavaLessonsBundle.message("java.onboarding.balloon.about.debug.panel",
strong(UIBundle.message("tool.window.name.debug")),
if (UIExperiment.isNewDebuggerUIEnabled()) 0 else 1,
@@ -397,20 +398,23 @@ class JavaOnboardingTourLesson : KLesson("java.onboarding", JavaLessonsBundle.me
}
task {
val introductionText = JavaLessonsBundle.message("java.onboarding.temporary.configuration.description",
strong(ActionsBundle.actionText("RedesignedRunToolbarWrapper")),
icon(AllIcons.Actions.Execute),
icon(AllIcons.Actions.StartDebugger))
val runOptionsText = if (PlatformUtils.isIdeaUltimate()) {
JavaLessonsBundle.message("java.onboarding.run.options.ultimate",
icon(AllIcons.Actions.Execute),
icon(AllIcons.Actions.StartDebugger),
icon(AllIcons.Actions.Profile),
icon(AllIcons.General.RunWithCoverage))
icon(AllIcons.General.RunWithCoverage),
icon(AllIcons.Actions.More))
}
else {
JavaLessonsBundle.message("java.onboarding.run.options.community",
icon(AllIcons.Actions.Execute),
icon(AllIcons.Actions.StartDebugger),
icon(AllIcons.General.RunWithCoverage))
icon(AllIcons.General.RunWithCoverage),
icon(AllIcons.Actions.More))
}
text(JavaLessonsBundle.message("java.onboarding.temporary.configuration.description") + " $runOptionsText")
text("$introductionText $runOptionsText")
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))
@@ -421,8 +425,8 @@ class JavaOnboardingTourLesson : KLesson("java.onboarding", JavaLessonsBundle.me
private fun LessonContext.openLearnToolwindow() {
task {
triggerAndBorderHighlight().component { stripe: StripeButton ->
stripe.windowInfo.id == "Learn"
triggerAndBorderHighlight().component { stripe: ActionButton ->
stripe.action.templateText == LearnBundle.message("toolwindow.stripe.Learn")
}
}
@@ -474,8 +478,8 @@ class JavaOnboardingTourLesson : KLesson("java.onboarding", JavaLessonsBundle.me
}
task {
triggerAndBorderHighlight().component { stripe: StripeButton ->
stripe.windowInfo.id == "Project"
triggerAndBorderHighlight().component { stripe: ActionButton ->
stripe.action.templateText == IdeUICustomization.getInstance().getProjectViewTitle(project)
}
}
@@ -487,7 +491,7 @@ class JavaOnboardingTourLesson : KLesson("java.onboarding", JavaLessonsBundle.me
text(JavaLessonsBundle.message("java.onboarding.project.view.description",
action("ActivateProjectToolWindow")))
text(JavaLessonsBundle.message("java.onboarding.balloon.project.view"),
LearningBalloonConfig(Balloon.Position.atRight, width = 0))
LearningBalloonConfig(Balloon.Position.atRight, width = 0, cornerToPointerDistance = JBUI.scale(8)))
triggerUI().treeItem { tree: JTree, path: TreePath ->
val result = path.pathCount >= 2 && path.getPathComponent(1).isToStringContains("IdeaLearningProject")
if (result) {
@@ -7,10 +7,10 @@ import com.intellij.codeInsight.documentation.QuickDocUtil.isDocumentationV2Enab
import com.intellij.execution.ui.UIExperiment
import com.intellij.execution.ui.layout.impl.RunnerLayoutSettings
import com.intellij.ide.IdeBundle
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.actionSystem.DataProvider
import com.intellij.openapi.actionSystem.ex.ComboBoxAction
import com.intellij.openapi.actionSystem.impl.ActionButton
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl
import com.intellij.openapi.application.ApplicationBundle
@@ -402,23 +402,12 @@ fun LessonContext.firstLessonCompletedMessage() {
fun LessonContext.highlightRunToolbar(highlightInside: Boolean = true, usePulsation: Boolean = true) {
task {
val stopAction = getActionById("Stop")
triggerAndBorderHighlight {
this.highlightInside = highlightInside
this.usePulsation = usePulsation
}.componentPart { ui: ActionToolbarImpl ->
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 stop = ui.components.find { it is ActionButton && it.action == stopAction }
if (configurations != null && stop != null) {
val x = configurations.x
val y = configurations.y
val width = stop.x + stop.width - x
val height = stop.y + stop.height - y
Rectangle(x, y, width, height)
}
else null
}
}.component { toolbar: ActionToolbarImpl ->
val actionId = ActionManager.getInstance().getId(toolbar.actionGroup)
actionId == "RunToolbarMainActionGroup" || actionId == "ContrastRunToolbarMainActionGroup"
}
}
}
@@ -24,10 +24,9 @@ python.onboarding.interpreter.description=PyCharm has already configured a Pytho
python.onboarding.interpreter.tip=<strong>Tip:</strong> here you can discover your Python interpreter settings
python.onboarding.indexing.description=When you open a project for the first time, <ide/> scans the Python SDK and the project itself \
to collect details required for coding assistance. To continue, wait until indexing completes.
python.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.
python.onboarding.run.options.community=For example, you can run your code {0} or debug it {1}.
python.onboarding.run.options.professional=For example, you can run your code {0}, debug it {1}, profile {2}, and run with coverage {3}.
python.onboarding.temporary.configuration.description=You have opened the demo sample. Now, let''s run it! In the highlighted {0}, \
you can see popular running actions for the selected configuration. For example, you can run your code {1} or debug it {2}.
python.onboarding.run.options.professional=Other actions like profile {0}, and run with coverage {1} can be showed by clicking on {2}.
python.onboarding.run.sample=For now, let''s run the current file, click {0} or press {1}.
python.onboarding.run.sample.balloon=Let''s run the current file, click {0} or press {1}.
python.onboarding.balloon.click.here=Click here to set a breakpoint
@@ -31,13 +31,14 @@ import com.intellij.openapi.ui.popup.Balloon
import com.intellij.openapi.util.WindowStateService
import com.intellij.openapi.wm.ToolWindowManager
import com.intellij.openapi.wm.impl.status.TextPanel
import com.intellij.toolWindow.StripeButton
import com.intellij.ui.IdeUICustomization
import com.intellij.ui.UIBundle
import com.intellij.ui.components.fields.ExtendableTextField
import com.intellij.ui.components.panels.NonOpaquePanel
import com.intellij.ui.tree.TreeVisitor
import com.intellij.util.Alarm
import com.intellij.util.PlatformUtils
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
import com.intellij.util.ui.tree.TreeUtil
import com.intellij.xdebugger.XDebuggerManager
@@ -232,7 +233,7 @@ class PythonOnboardingTourLesson :
toggleBreakpointTask(sample, { logicalPosition }, checkLine = false) {
text(PythonLessonsBundle.message("python.onboarding.balloon.click.here"),
LearningBalloonConfig(Balloon.Position.below, width = 0, duplicateMessage = false))
LearningBalloonConfig(Balloon.Position.below, width = 0, cornerToPointerDistance = JBUI.scale(20)))
text(PythonLessonsBundle.message("python.onboarding.toggle.breakpoint.1",
code("6.5"), code("find_average"), code("26")))
text(PythonLessonsBundle.message("python.onboarding.toggle.breakpoint.2"))
@@ -253,7 +254,7 @@ class PythonOnboardingTourLesson :
task {
rehighlightPreviousUi = true
gotItStep(Balloon.Position.above, 400,
gotItStep(Balloon.Position.above, width = 0,
PythonLessonsBundle.message("python.onboarding.balloon.about.debug.panel",
strong(UIBundle.message("tool.window.name.debug")),
if (UIExperiment.isNewDebuggerUIEnabled()) 0 else 1,
@@ -319,19 +320,20 @@ class PythonOnboardingTourLesson :
}
task {
val runOptionsText = if (PlatformUtils.isPyCharmCommunity()) {
PythonLessonsBundle.message("python.onboarding.run.options.community",
icon(AllIcons.Actions.Execute),
icon(AllIcons.Actions.StartDebugger))
val introductionText = PythonLessonsBundle.message("python.onboarding.temporary.configuration.description",
strong(ActionsBundle.actionText("RedesignedRunToolbarWrapper")),
icon(AllIcons.Actions.Execute),
icon(AllIcons.Actions.StartDebugger))
@Suppress("DEPRECATION")
val runOptionsText = if (PlatformUtils.isPyCharmPro()) {
" " + PythonLessonsBundle.message("python.onboarding.run.options.professional",
icon(AllIcons.Actions.Profile),
icon(AllIcons.General.RunWithCoverage),
icon(AllIcons.Actions.More))
}
else {
PythonLessonsBundle.message("python.onboarding.run.options.professional",
icon(AllIcons.Actions.Execute),
icon(AllIcons.Actions.StartDebugger),
icon(AllIcons.Actions.Profile),
icon(AllIcons.General.RunWithCoverage))
}
text(PythonLessonsBundle.message("python.onboarding.temporary.configuration.description") + " $runOptionsText")
else ""
text("$introductionText$runOptionsText")
text(PythonLessonsBundle.message("python.onboarding.run.sample", icon(AllIcons.Actions.Execute), action("Run")))
text(PythonLessonsBundle.message("python.onboarding.run.sample.balloon", icon(AllIcons.Actions.Execute), action("Run")),
LearningBalloonConfig(Balloon.Position.below, 0))
@@ -342,8 +344,8 @@ class PythonOnboardingTourLesson :
private fun LessonContext.openLearnToolwindow() {
task {
triggerAndBorderHighlight().component { stripe: StripeButton ->
stripe.windowInfo.id == "Learn"
triggerAndBorderHighlight().component { stripe: ActionButton ->
stripe.action.templateText == LearnBundle.message("toolwindow.stripe.Learn")
}
}
@@ -394,8 +396,8 @@ class PythonOnboardingTourLesson :
LessonUtil.hideStandardToolwindows(project)
}
task {
triggerAndBorderHighlight().component { stripe: StripeButton ->
stripe.windowInfo.id == "Project"
triggerAndBorderHighlight().component { stripe: ActionButton ->
stripe.action.templateText == IdeUICustomization.getInstance().getProjectViewTitle(project)
}
}
@@ -405,7 +407,7 @@ class PythonOnboardingTourLesson :
text(PythonLessonsBundle.message("python.onboarding.project.view.description",
action("ActivateProjectToolWindow")))
text(PythonLessonsBundle.message("python.onboarding.balloon.project.view"),
LearningBalloonConfig(Balloon.Position.atRight, width = 0))
LearningBalloonConfig(Balloon.Position.atRight, width = 0, cornerToPointerDistance = JBUI.scale(8)))
triggerAndBorderHighlight().treeItem { tree: JTree, path: TreePath ->
val result = path.pathCount >= 1 && path.getPathComponent(0).isToStringContains("PyCharmLearningProject")
if (result) {