mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-246446 extract onboarding browser rendering to JCEF module
Introduce a browser-page renderer extension for onboarding so the base onboarding module can build UI without depending directly on JCEF. The JCEF-backed renderer lives in its own content module, while onboarding callers gracefully skip browser promo content when that renderer is unavailable. IJ-MR-184958 IJ-MR-184993 IJ-MR-179029 IJ-MR-184126 IJ-MR-181153 IJ-MR-146078 IJ-MR-175479 IJ-MR-186058 IJ-MR-193195 IJ-MR-196957 IJ-MR-199124 IJ-MR-197441 IJ-MR-204135 IJ-MR-204674 GitOrigin-RevId: 7ad4a4c7db26d5f4804845bdb4fa59099b92f19c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6a73540d50
commit
094dd02789
@@ -34,7 +34,6 @@ jvm_library(
|
||||
"//libraries/kotlinx/serialization/json",
|
||||
"//platform/projectModel-api:projectModel",
|
||||
"//platform/statistics",
|
||||
"//libraries/jcef",
|
||||
"//platform/util:util-ui",
|
||||
],
|
||||
)
|
||||
@@ -64,7 +63,6 @@ jvm_library(
|
||||
"//libraries/kotlinx/serialization/json:json_test_lib",
|
||||
"//platform/projectModel-api:projectModel_test_lib",
|
||||
"//platform/statistics:statistics_test_lib",
|
||||
"//libraries/jcef:jcef_test_lib",
|
||||
"//platform/util:util-ui_test_lib",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
<orderEntry type="module" module-name="intellij.libraries.kotlinx.serialization.json" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" />
|
||||
<orderEntry type="module" module-name="intellij.platform.statistics" />
|
||||
<orderEntry type="module" module-name="intellij.libraries.jcef" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,62 @@
|
||||
load("@rules_jvm//:jvm.bzl", "jvm_library")
|
||||
|
||||
### auto-generated section `build intellij.platform.ide.newUiOnboarding.jcef` start
|
||||
|
||||
jvm_library(
|
||||
name = "jcef",
|
||||
srcs = glob(
|
||||
[
|
||||
"src/**/*.kt",
|
||||
"src/**/*.java",
|
||||
"src/**/*.form",
|
||||
],
|
||||
allow_empty = True,
|
||||
),
|
||||
module_name = "intellij.platform.ide.newUiOnboarding.jcef",
|
||||
resource_strip_prefix = "resources",
|
||||
resources = glob(
|
||||
["resources/**/*"],
|
||||
),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
# do not sort,
|
||||
"@lib//:jetbrains-annotations",
|
||||
"//platform/core-api:core",
|
||||
"//platform/core-impl",
|
||||
"//platform/platform-api:ide",
|
||||
"//platform/new-ui-onboarding",
|
||||
"//platform/ui.jcef",
|
||||
"//platform/util:util-ui",
|
||||
],
|
||||
)
|
||||
|
||||
jvm_library(
|
||||
name = "jcef_test_lib",
|
||||
testonly = True,
|
||||
srcs = glob(
|
||||
[],
|
||||
allow_empty = True,
|
||||
),
|
||||
module_name = "intellij.platform.ide.newUiOnboarding.jcef",
|
||||
visibility = ["//visibility:public"],
|
||||
runtime_deps = [
|
||||
# do not sort,
|
||||
":jcef",
|
||||
"//platform/core-api:core_test_lib",
|
||||
"//platform/core-impl:core-impl_test_lib",
|
||||
"//platform/platform-api:ide_test_lib",
|
||||
"//platform/new-ui-onboarding:new-ui-onboarding_test_lib",
|
||||
"//platform/ui.jcef:ui.jcef_test_lib",
|
||||
"//platform/util:util-ui_test_lib",
|
||||
],
|
||||
)
|
||||
### auto-generated section `build intellij.platform.ide.newUiOnboarding.jcef` end
|
||||
|
||||
### auto-generated section `iml intellij.platform.ide.newUiOnboarding.jcef` start
|
||||
exports_files(
|
||||
[
|
||||
"intellij.platform.ide.newUiOnboarding.jcef.iml",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
### auto-generated section `iml intellij.platform.ide.newUiOnboarding.jcef` end
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="5" platform="JVM 25" allPlatforms="JVM [25]" useProjectSettings="false">
|
||||
<compilerSettings>
|
||||
<option name="additionalArguments" value="-Xjvm-default=all -XXLanguage:+AllowEagerSupertypeAccessibilityChecks -progressive" />
|
||||
</compilerSettings>
|
||||
<compilerArguments>
|
||||
<stringArguments>
|
||||
<stringArg name="jvmTarget" arg="25" />
|
||||
<stringArg name="apiVersion" arg="2.3" />
|
||||
<stringArg name="languageVersion" arg="2.3" />
|
||||
</stringArguments>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<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="library" name="jetbrains-annotations" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.newUiOnboarding" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ui.jcef" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,3 @@
|
||||
- name: dist.all/lib/intellij.platform.ide.newUiOnboarding.jcef.jar
|
||||
modules:
|
||||
- name: intellij.platform.ide.newUiOnboarding.jcef
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<idea-plugin>
|
||||
<!-- region Generated dependencies - run `Generate Product Layouts` to regenerate -->
|
||||
<dependencies>
|
||||
<module name="intellij.platform.core"/>
|
||||
<module name="intellij.platform.core.impl"/>
|
||||
<module name="intellij.platform.ide"/>
|
||||
<module name="intellij.platform.ide.newUiOnboarding"/>
|
||||
<module name="intellij.platform.ui.jcef"/>
|
||||
<module name="intellij.platform.util.ui"/>
|
||||
</dependencies>
|
||||
<!-- endregion -->
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij.ide.newUiOnboarding">
|
||||
<browserPageRenderer implementation="com.intellij.platform.ide.newUiOnboarding.jcef.JcefNewUiOnboardingBrowserPageRenderer"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.platform.ide.newUiOnboarding.jcef
|
||||
|
||||
import com.intellij.platform.ide.newUiOnboarding.NewUiOnboardingBrowserPageRenderer
|
||||
import com.intellij.ui.components.panels.Wrapper
|
||||
import com.intellij.ui.jcef.JBCefApp
|
||||
import com.intellij.ui.jcef.JBCefBrowser
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import java.awt.Dimension
|
||||
import java.awt.Graphics
|
||||
import javax.swing.JComponent
|
||||
|
||||
@ApiStatus.Internal
|
||||
class JcefNewUiOnboardingBrowserPageRenderer : NewUiOnboardingBrowserPageRenderer {
|
||||
override fun createBrowserPageComponent(htmlText: String, size: Dimension): JComponent? {
|
||||
if (!JBCefApp.isSupported()) {
|
||||
return null
|
||||
}
|
||||
|
||||
val browser = JBCefBrowser.createBuilder().setMouseWheelEventEnable(false).build()
|
||||
browser.loadHTML(htmlText)
|
||||
return object : Wrapper(browser.component) {
|
||||
override fun paint(g: Graphics?) {
|
||||
super.paint(g)
|
||||
super.paintBorder(g)
|
||||
}
|
||||
}.also {
|
||||
UIUtil.setNotOpaqueRecursively(it)
|
||||
val adjustedSize = Dimension(size.width + 2, size.height + 2)
|
||||
it.minimumSize = adjustedSize
|
||||
it.preferredSize = adjustedSize
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,9 @@
|
||||
beanClass="com.intellij.platform.ide.newUiOnboarding.newUi.NewUiOnboardingBean"
|
||||
dynamic="true">
|
||||
</extensionPoint>
|
||||
<extensionPoint qualifiedName="com.intellij.ide.newUiOnboarding.browserPageRenderer"
|
||||
interface="com.intellij.platform.ide.newUiOnboarding.NewUiOnboardingBrowserPageRenderer"
|
||||
dynamic="true"/>
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij.ide.newUiOnboarding">
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.platform.ide.newUiOnboarding
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import java.awt.Dimension
|
||||
import javax.swing.JComponent
|
||||
|
||||
@ApiStatus.Internal
|
||||
interface NewUiOnboardingBrowserPageRenderer {
|
||||
fun createBrowserPageComponent(htmlText: String, size: Dimension): JComponent?
|
||||
|
||||
companion object {
|
||||
private val EP_NAME = ExtensionPointName<NewUiOnboardingBrowserPageRenderer>("com.intellij.ide.newUiOnboarding.browserPageRenderer")
|
||||
|
||||
fun createComponent(htmlText: String, size: Dimension): JComponent? =
|
||||
EP_NAME.extensionList.firstNotNullOfOrNull { it.createBrowserPageComponent(htmlText, size) }
|
||||
}
|
||||
}
|
||||
+4
@@ -59,6 +59,7 @@ import java.awt.Component
|
||||
import java.awt.Dimension
|
||||
import java.awt.Point
|
||||
import java.awt.Rectangle
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.Icon
|
||||
import javax.swing.SwingUtilities
|
||||
|
||||
@@ -242,6 +243,9 @@ object NewUiOnboardingUtil {
|
||||
return htmlPage to size
|
||||
}
|
||||
|
||||
fun createBrowserPageComponent(htmlText: String, size: Dimension): JComponent? =
|
||||
NewUiOnboardingBrowserPageRenderer.createComponent(htmlText, size)
|
||||
|
||||
suspend fun createSettingsEntryPointPopup(project: Project, disposable: CheckedDisposable): JBPopup? {
|
||||
val settingsButton = UiComponentsSearchUtil.findUiComponent(project) { button: ActionButton ->
|
||||
button.action is SettingsEntryPointAction
|
||||
|
||||
+3
-1
@@ -57,7 +57,9 @@ open class RunWidgetStep : NewUiOnboardingStep {
|
||||
NewUiOnboardingUtil.createLottieAnimationPage(animationPath, animationClassLoader)
|
||||
}
|
||||
lottiePageData?.let { (html, size) ->
|
||||
builder.withBrowserPage(html, size, withBorder = true)
|
||||
NewUiOnboardingUtil.createBrowserPageComponent(html, size)?.let {
|
||||
builder.withCustomComponentPromo(it, withBorder = true)
|
||||
}
|
||||
}
|
||||
|
||||
val point = NewUiOnboardingUtil.convertPointToFrame(project, runPopup.content, JBPoint(-4, 27)) ?: return null
|
||||
|
||||
+3
-1
@@ -35,7 +35,9 @@ open class ToolWindowLayoutsStep : NewUiOnboardingStep {
|
||||
NewUiOnboardingUtil.createLottieAnimationPage(LOTTIE_JSON_PATH, ToolWindowLayoutsStep::class.java.classLoader)
|
||||
}
|
||||
lottiePageData?.let { (html, size) ->
|
||||
builder.withBrowserPage(html, size, withBorder = true)
|
||||
NewUiOnboardingUtil.createBrowserPageComponent(html, size)?.let {
|
||||
builder.withCustomComponentPromo(it, withBorder = true)
|
||||
}
|
||||
}
|
||||
return NewUiOnboardingStepData(builder, RelativePoint(ideFrame.rootPane, Point(0, 0)), position = null) // show in the center
|
||||
}
|
||||
|
||||
+3
-1
@@ -35,7 +35,9 @@ internal class SearchEverywhereStep : NewUiOnboardingStep {
|
||||
NewUiOnboardingUtil.createLottieAnimationPage(LOTTIE_JSON_PATH, SearchEverywhereStep::class.java.classLoader)
|
||||
}
|
||||
lottiePageData?.let { (html, size) ->
|
||||
builder.withBrowserPage(html, size, withBorder = true)
|
||||
NewUiOnboardingUtil.createBrowserPageComponent(html, size)?.let {
|
||||
builder.withCustomComponentPromo(it, withBorder = true)
|
||||
}
|
||||
}
|
||||
|
||||
val point = Point(searchEverywhereButton.width / 2, searchEverywhereButton.height + JBUI.scale(3))
|
||||
|
||||
Reference in New Issue
Block a user