IJPL-43794 Add Learn tool window step to New Users Onboarding

GitOrigin-RevId: cd4b95ceff674464412aeb495f27fa351ef4fc75
This commit is contained in:
Konstantin Hudyakov
2024-07-11 19:00:16 +03:00
committed by intellij-monorepo-bot
parent 74b0dd5834
commit 50bd1a9a52
8 changed files with 71 additions and 1 deletions

1
.idea/modules.xml generated
View File

@@ -340,6 +340,7 @@
<module fileurl="file://$PROJECT_DIR$/platform/execution-process-mediator/common/intellij.execution.process.mediator.common.iml" filepath="$PROJECT_DIR$/platform/execution-process-mediator/common/intellij.execution.process.mediator.common.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/execution-process-mediator/daemon/intellij.execution.process.mediator.daemon.iml" filepath="$PROJECT_DIR$/platform/execution-process-mediator/daemon/intellij.execution.process.mediator.daemon.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/ide-features-trainer/intellij.featuresTrainer.iml" filepath="$PROJECT_DIR$/plugins/ide-features-trainer/intellij.featuresTrainer.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/ide-features-trainer/onboarding/intellij.featuresTrainer.onboarding.iml" filepath="$PROJECT_DIR$/plugins/ide-features-trainer/onboarding/intellij.featuresTrainer.onboarding.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/filePrediction/intellij.filePrediction.iml" filepath="$PROJECT_DIR$/plugins/filePrediction/intellij.filePrediction.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/gradle/intellij.gradle.iml" filepath="$PROJECT_DIR$/plugins/gradle/intellij.gradle.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/gradle/intellij.gradle.analysis/intellij.gradle.analysis.iml" filepath="$PROJECT_DIR$/plugins/gradle/intellij.gradle.analysis/intellij.gradle.analysis.iml" />

View File

@@ -73,7 +73,8 @@ internal class NewUsersOnboardingService(private val project: Project, private v
"runWidget",
"searchEverywhere",
"toolWindowLayouts",
"moreToolWindows"
"moreToolWindows",
"learnToolWindow"
)
}

View File

@@ -54,5 +54,6 @@
<orderEntry type="module" module-name="intellij.platform.lvcs.impl" />
<orderEntry type="module" module-name="intellij.platform.tips" />
<orderEntry type="module" module-name="intellij.platform.diagnostic" />
<orderEntry type="module" module-name="intellij.featuresTrainer.onboarding" scope="RUNTIME" />
</component>
</module>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
<orderEntry type="module" module-name="intellij.platform.ide.newUiOnboarding" />
<orderEntry type="module" module-name="intellij.featuresTrainer" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
</component>
</module>

View File

@@ -0,0 +1,9 @@
<idea-plugin package="com.intellij.featuresTrainer.onboarding">
<dependencies>
<module name="intellij.platform.ide.newUiOnboarding"/>
</dependencies>
<extensions defaultExtensionNs="com.intellij.ide.newUiOnboarding">
<step key="learnToolWindow" implementationClass="com.intellij.featuresTrainer.onboarding.LearnToolWindowStep"/>
</extensions>
</idea-plugin>

View File

@@ -0,0 +1,37 @@
package com.intellij.featuresTrainer.onboarding
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.popup.Balloon
import com.intellij.openapi.util.CheckedDisposable
import com.intellij.openapi.util.Disposer
import com.intellij.platform.ide.newUiOnboarding.NewUiOnboardingStep
import com.intellij.platform.ide.newUiOnboarding.NewUiOnboardingStepData
import com.intellij.ui.GotItComponentBuilder
import com.intellij.ui.awt.RelativePoint
import com.intellij.util.ui.JBUI
import kotlinx.coroutines.yield
import training.learn.LearnBundle
import training.util.learningToolWindow
import java.awt.Point
import kotlin.math.min
internal class LearnToolWindowStep : NewUiOnboardingStep {
override suspend fun performStep(project: Project, disposable: CheckedDisposable): NewUiOnboardingStepData? {
val toolWindow = learningToolWindow(project) ?: return null
toolWindow.show(null)
yield() // wait for the tool window to appear
// Hide the tool window back when the step is finished
Disposer.register(disposable) {
toolWindow.hide()
}
val builder = GotItComponentBuilder(LearnBundle.message("newUsersOnboarding.learn.step.text"))
builder.withHeader(LearnBundle.message("newUsersOnboarding.learn.step.header"))
val component = toolWindow.component
val point = Point(component.width + JBUI.scale(3), min(JBUI.scale(150), component.height / 2))
return NewUiOnboardingStepData(builder, RelativePoint(component, point), Balloon.Position.atRight)
}
}

View File

@@ -20,6 +20,7 @@
<content>
<module name="intellij.vcs.git.featuresTrainer"/>
<module name="intellij.featuresTrainer.onboarding"/>
</content>
<resource-bundle>messages.LearnBundle</resource-bundle>

View File

@@ -146,3 +146,7 @@ onboarding.debug.got.it.header=Debug Controls
onboarding.debug.got.it.text=This is the Debug tool window. Here, you can use various actions like Step In {0}, Resume {1}, and Stop {2}.
onboarding.propose.to.disable.tips=Don\u2019t want to see comments with onboarding tips?
onboarding.disable.tips.action=Disable onboarding tips
newUsersOnboarding.learn.step.header=Learn
newUsersOnboarding.learn.step.text=Explore other IDE features with the Learn tool window, \
offering interactive tutorials on a wide range of topics