IJPL-158505 JetBrains Tech Insights Lab (research panel) promo in IDEs

GitOrigin-RevId: 2ff5aa0dc9246645cfcf889d59b019106e5f6ef3
This commit is contained in:
Alexander Lobas
2025-02-07 11:59:42 +01:00
committed by intellij-monorepo-bot
parent 9cabefdcd0
commit fba87eacbc
6 changed files with 48 additions and 4 deletions

View File

@@ -5043,6 +5043,7 @@ a:com.intellij.openapi.wm.BannerStartPagePromoter
- pa:getHeaderLabel():java.lang.String
- pa:getPromoImage():javax.swing.Icon
- getPromotion(Z):javax.swing.JComponent
- p:onBannerHide():V
- p:onBannerShown():V
- pa:runAction():V
com.intellij.openapi.wm.CustomStatusBarWidget

View File

@@ -3225,7 +3225,7 @@ trial.survey.no.goal=I do not have a specific goal
trial.survey.another.reason=My reason is not listed here
tech.insights.lab.promoter.title=Join the JetBrains Tech Insights Lab!
tech.insights.lab.promoter.description=Sign up for our internal panel, participate in remote interviews, surveys, usability testing, and similar research activities and shape the future of JetBrains products!
tech.insights.lab.promoter.description=Sign up to participate in remote interviews, surveys, and usability testing to help shape the future of JetBrains products!
tech.insights.lab.promoter.action=Sign Up\u2026

View File

@@ -9,8 +9,11 @@ import com.intellij.ui.InplaceButton
import com.intellij.ui.JBColor
import com.intellij.ui.components.panels.BackgroundRoundedPanel
import com.intellij.ui.components.panels.NonOpaquePanel
import com.intellij.ui.dsl.gridLayout.*
import com.intellij.ui.dsl.gridLayout.GridLayout
import com.intellij.ui.dsl.gridLayout.HorizontalAlign
import com.intellij.ui.dsl.gridLayout.UnscaledGapsY
import com.intellij.ui.dsl.gridLayout.builders.RowsGridBuilder
import com.intellij.ui.dsl.gridLayout.toUnscaledGaps
import com.intellij.ui.scale.JBUIScale
import com.intellij.util.ui.JBFont
import com.intellij.util.ui.JBUI
@@ -42,6 +45,10 @@ abstract class BannerStartPagePromoter : StartPagePromoter {
override fun showNotify() {
onBannerShown()
}
override fun hideNotify() {
onBannerHide()
}
})
}
@@ -114,6 +121,8 @@ abstract class BannerStartPagePromoter : StartPagePromoter {
protected open fun onBannerShown() {}
protected open fun onBannerHide() {}
protected open fun createHeader(): JLabel {
val result = JLabel(headerLabel)
val labelFont = StartupUiUtil.labelFont

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -6,10 +6,13 @@ import com.intellij.ide.IdeBundle
import com.intellij.ide.util.PropertiesComponent
import com.intellij.internal.statistic.eventLog.EventLogGroup
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.ConfigImportHelper
import com.intellij.openapi.util.IconLoader
import com.intellij.openapi.wm.BannerStartPagePromoter
import com.intellij.ui.LicensingFacade
import com.intellij.ui.ScreenUtil
import com.intellij.util.messages.MessageBusConnection
import org.jetbrains.annotations.Nls
import java.util.*
import javax.swing.Icon
@@ -48,6 +51,8 @@ internal class TechInsightsLabPromoter : BannerStartPagePromoter() {
it.set(2025, Calendar.JUNE, 1, 0, 1)
}
private var facadeConnection: MessageBusConnection? = null
override fun getPromotion(isEmptyState: Boolean): JComponent {
val promotion = super.getPromotion(isEmptyState)
promoPanel = promotion
@@ -73,7 +78,8 @@ internal class TechInsightsLabPromoter : BannerStartPagePromoter() {
if (PropertiesComponent.getInstance().getBoolean(BUTTON_CLICKED_PROPERTY)) {
return false
}
if (LicensingFacade.getInstance()?.isEvaluationLicense == true) {
val facade = LicensingFacade.getInstance()
if (facade?.isEvaluationLicense == true) {
return false
}
if (ConfigImportHelper.isFirstSession() || ConfigImportHelper.isConfigImported()) {
@@ -81,7 +87,35 @@ internal class TechInsightsLabPromoter : BannerStartPagePromoter() {
}
val now = Calendar.getInstance()
return now.before(endDate) && now.after(startDate)
if (now.before(endDate) && now.after(startDate) || java.lang.Boolean.getBoolean("ignore.promo.dates")) {
if (facade == null && facadeConnection == null) {
val connection = ApplicationManager.getApplication().messageBus.connect()
facadeConnection = connection
connection.subscribe(LicensingFacade.LicenseStateListener.TOPIC, LicensingFacade.LicenseStateListener { facade ->
if (facade == null) {
return@LicenseStateListener
}
facadeConnection = null
connection.disconnect()
if (facade.isEvaluationLicense) {
promoPanel?.let {
it.isVisible = false
it.revalidate()
}
}
})
}
return true
}
return false
}
override fun onBannerHide() {
if (promoPanel != null && ScreenUtil.isStandardAddRemoveNotify(promoPanel)) {
facadeConnection?.disconnect()
facadeConnection = null
}
}
}