mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[platform][ultimate] IDEA-321298 try ultimate logic for pycharm promo was added
GitOrigin-RevId: 88bb7a930b6e3723660f562455670a5016ff9331
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a1f0b660e3
commit
bee68bb4e5
@@ -640,15 +640,16 @@ data class SuggestedIde(
|
||||
fun tryUltimate(
|
||||
pluginId: PluginId?,
|
||||
suggestedIde: SuggestedIde,
|
||||
project: Project,
|
||||
project: Project?,
|
||||
fusEventSource: FUSEventSource? = null,
|
||||
fallback: (() -> Unit)? = null
|
||||
) {
|
||||
val eventSource = fusEventSource ?: FUSEventSource.EDITOR
|
||||
if (Registry.`is`("ide.try.ultimate.automatic.installation")) {
|
||||
if (Registry.`is`("ide.try.ultimate.automatic.installation") && project != null) {
|
||||
eventSource.logTryUltimate(project, pluginId)
|
||||
project.service<UltimateInstallationService>().install(pluginId, suggestedIde)
|
||||
} else {
|
||||
eventSource.openDownloadPageAndLog(project = project, url = suggestedIde.defaultDownloadUrl, pluginId = pluginId)
|
||||
fallback?.invoke() ?: eventSource.openDownloadPageAndLog(project = project, url = suggestedIde.defaultDownloadUrl, pluginId = pluginId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,11 @@ class PromoFeatureListItem(
|
||||
)
|
||||
|
||||
object PromoPages {
|
||||
fun build(page: PromoFeaturePage, openLearnMore: (url: String) -> Unit, openDownloadLink: (DialogWrapper?) -> Unit): DialogPanel {
|
||||
fun build(
|
||||
page: PromoFeaturePage,
|
||||
openLearnMore: (url: String) -> Unit,
|
||||
openDownloadLink: (DialogWrapper?) -> Unit
|
||||
): DialogPanel {
|
||||
val panel = panel {
|
||||
row {
|
||||
icon(page.productIcon)
|
||||
@@ -98,19 +102,21 @@ object PromoPages {
|
||||
})
|
||||
}
|
||||
|
||||
fun buildWithTryUltimate(page: PromoFeaturePage, source: FUSEventSource = FUSEventSource.SETTINGS): DialogPanel {
|
||||
fun buildWithTryUltimate(
|
||||
page: PromoFeaturePage,
|
||||
openLearnMore: ((url: String) -> Unit)? = null,
|
||||
openDownloadLink: (() -> Unit)? = null,
|
||||
source: FUSEventSource = FUSEventSource.SETTINGS,
|
||||
): DialogPanel {
|
||||
val pluginId = page.pluginId?.let(PluginId::getId)
|
||||
val project = ProjectManager.getInstance().openProjects.firstOrNull()
|
||||
|
||||
return build(
|
||||
page = page,
|
||||
openLearnMore = { source.learnMoreAndLog(project, it, pluginId) },
|
||||
openLearnMore = { openLearnMore?.invoke(it) ?: source.learnMoreAndLog(project, it, pluginId) },
|
||||
openDownloadLink = { dialog ->
|
||||
if (project != null) {
|
||||
tryUltimate(pluginId, page.suggestedIde, project, source)
|
||||
dialog?.close(DialogWrapper.CLOSE_EXIT_CODE)
|
||||
}
|
||||
else source.openDownloadPageAndLog(null, page.suggestedIde.downloadUrl, pluginId)
|
||||
tryUltimate(pluginId, page.suggestedIde, project, source, openDownloadLink)
|
||||
dialog?.close(DialogWrapper.CLOSE_EXIT_CODE)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PluginAdvertiserService
|
||||
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.tryUltimate
|
||||
import com.jetbrains.python.icons.PythonIcons
|
||||
import javax.swing.Icon
|
||||
|
||||
@@ -23,7 +24,13 @@ internal abstract class ProPromoAction(private val topic: PromoTopic): AnAction(
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
createOpenDownloadPageLambda(PromoEventSource.GO_TO_ACTION, topic).invoke()
|
||||
tryUltimate(
|
||||
null,
|
||||
PluginAdvertiserService.pyCharmProfessional,
|
||||
e.project,
|
||||
null,
|
||||
createOpenDownloadPageLambda(PromoEventSource.GO_TO_ACTION, topic)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PromoFeatur
|
||||
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PromoPages
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.intellij.pycharm.community.ide.impl.PyCharmCommunityCustomizationBundle
|
||||
import com.jetbrains.python.icons.PythonIcons
|
||||
import com.jetbrains.python.newProject.PyNewProjectSettings
|
||||
import com.jetbrains.python.newProject.PythonProjectGenerator
|
||||
import com.jetbrains.python.newProject.PythonPromoProjectGenerator
|
||||
import com.jetbrains.python.icons.PythonIcons
|
||||
import javax.swing.Icon
|
||||
import javax.swing.JPanel
|
||||
|
||||
@@ -29,7 +29,7 @@ internal class DjangoPromoProjectGenerator : PythonProjectGenerator<PyNewProject
|
||||
}
|
||||
|
||||
override fun createPromoPanel(): JPanel {
|
||||
return PromoPages.build(
|
||||
return PromoPages.buildWithTryUltimate(
|
||||
PromoFeaturePage(
|
||||
PythonIcons.Python.Pycharm,
|
||||
PluginAdvertiserService.pyCharmProfessional,
|
||||
|
||||
@@ -19,10 +19,10 @@ private fun featurePage(@NlsContexts.Label title: String, items: List<PromoFeatu
|
||||
trialLabel = FeaturePromoBundle.message("free.trial.hint"),
|
||||
pluginId = null
|
||||
)
|
||||
return PromoPages.build(
|
||||
return PromoPages.buildWithTryUltimate(
|
||||
page = page,
|
||||
openLearnMore = createOpenLearnMorePageLambda(source, topic),
|
||||
openDownloadLink = createOpenDownloadPageLambda(source, topic)
|
||||
openDownloadLink = createOpenDownloadPageLambda(source, topic),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user