[platform] provide a way to specify the download page URL in ExternalProductResourceUrls (IJPL-204)

...instead of using 'productUrl' in *ApplicationInfo.xml. Third-party IDEs can organize their sites differently, so it's better not to suppose that URLs of their download pages always end with '/download'.
Now this convention is specified for JetBrains' IDEs only in BaseJetBrainsExternalProductResourceUrls.

IntelliJ IDEA has been migrated to use the new property.

GitOrigin-RevId: 366569f01a8ad84094bc600692774c31d8e3eff2
This commit is contained in:
Nikolay Chashnikov
2023-08-21 13:36:52 +02:00
committed by intellij-monorepo-bot
parent 66bb100190
commit f71381a8e1
8 changed files with 30 additions and 8 deletions

View File

@@ -6,7 +6,6 @@
<icon svg="/idea-ce.svg" svg-small="/idea-ce_16.svg"/>
<icon-eap svg="/idea-ce-eap.svg" svg-small="/idea-ce-eap_16.svg"/>
<names product="IDEA" fullname="IntelliJ IDEA" edition="Community Edition" script="idea" motto="Capable and Ergonomic IDE for JVM"/>
<productUrl url="https://www.jetbrains.com/idea/"/>
<essential-plugin>com.intellij.java</essential-plugin>
<essential-plugin>com.intellij.java.ide</essential-plugin>

View File

@@ -8,7 +8,10 @@ import com.intellij.platform.ide.impl.customization.ZenDeskFeedbackFormFieldIds
class IntelliJIdeaExternalResourceUrls : BaseJetBrainsExternalProductResourceUrls() {
override val basePatchDownloadUrl: String
get() = "https://download.jetbrains.com/idea/"
override val productPageUrl: String
get() = "https://www.jetbrains.com/idea/"
override val youtrackProjectId: String
get() = "IDEA"

View File

@@ -70,6 +70,12 @@ interface ExternalProductResourceUrls {
*/
val feedbackReporter: FeedbackReporter?
get() = null
/**
* Returns URL of the product's download page. It will be shown in the browser if automatic downloading isn't available for some reason.
*/
val downloadPageUrl: Url?
get() = null
}
/**

View File

@@ -19,7 +19,6 @@ import com.intellij.openapi.application.Application
import com.intellij.openapi.application.ApplicationNamesInfo
import com.intellij.openapi.application.EDT
import com.intellij.openapi.application.PathManager
import com.intellij.openapi.application.ex.ApplicationInfoEx
import com.intellij.openapi.application.ex.ApplicationManagerEx
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.logger
@@ -31,6 +30,7 @@ import com.intellij.openapi.util.NlsContexts
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.SystemInfoRt
import com.intellij.platform.ide.CoreUiCoroutineScopeHolder
import com.intellij.platform.ide.customization.ExternalProductResourceUrls
import com.intellij.util.SystemProperties
import com.intellij.util.lang.JavaVersion
import com.intellij.util.system.CpuArch
@@ -150,8 +150,10 @@ private suspend fun checkRuntime() {
LOG.info("${CpuArch.CURRENT} appears to be emulated")
if (SystemInfoRt.isMac && CpuArch.isIntel64()) {
val downloadAction = NotificationAction.createSimpleExpiring(IdeBundle.message("bundled.jre.m1.arch.message.download")) {
BrowserUtil.browse(ApplicationInfoEx.getInstanceEx().downloadUrl)
val downloadAction = ExternalProductResourceUrls.getInstance().downloadPageUrl?.let { downloadPageUrl ->
NotificationAction.createSimpleExpiring(IdeBundle.message("bundled.jre.m1.arch.message.download")) {
BrowserUtil.browse(downloadPageUrl.toExternalForm())
}
}
showNotification("bundled.jre.m1.arch.message", suppressable = true, downloadAction, ApplicationNamesInfo.getInstance().fullProductName)
}

View File

@@ -6,12 +6,12 @@ import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.application.ApplicationNamesInfo
import com.intellij.openapi.application.IdeUrlTrackingParametersProvider
import com.intellij.openapi.application.PathManager
import com.intellij.openapi.application.ex.ApplicationInfoEx
import com.intellij.openapi.options.ShowSettingsUtil
import com.intellij.openapi.ui.VerticalFlowLayout
import com.intellij.openapi.util.NlsContexts
import com.intellij.openapi.util.NlsSafe
import com.intellij.openapi.util.SystemInfo
import com.intellij.platform.ide.customization.ExternalProductResourceUrls
import com.intellij.ui.BrowserHyperlinkListener
import com.intellij.ui.JBColor
import com.intellij.ui.ScrollPaneFactory
@@ -152,7 +152,7 @@ internal object UpdateInfoPanel {
newBuild.downloadUrl ?:
newBuild.blogPost ?:
updatedChannel.url ?:
ApplicationInfoEx.getInstanceEx().downloadUrl ?:
ExternalProductResourceUrls.getInstance().downloadPageUrl?.toExternalForm() ?:
ApplicationInfo.getInstance().companyURL ?:
"https://www.jetbrains.com")
}

View File

@@ -28,6 +28,12 @@ abstract class BaseJetBrainsExternalProductResourceUrls : ExternalProductResourc
*/
abstract val shortProductNameUsedInForms: String
/**
* Returns URL of the product page on jetbrains.com site.
* It's supposed that by appending `download` to this URL you get the address of the download page.
*/
abstract val productPageUrl: String
/**
* Returns ID of the form used to contact support at intellij-support.jetbrains.com site
*/
@@ -72,6 +78,9 @@ abstract class BaseJetBrainsExternalProductResourceUrls : ExternalProductResourc
override val feedbackReporter: FeedbackReporter?
get() = JetBrainsFeedbackReporter(shortProductNameUsedInForms, zenDeskFeedbackFormData)
override val downloadPageUrl: Url?
get() = Urls.newFromEncoded(productPageUrl).resolve("download")
}
/**

View File

@@ -67,4 +67,7 @@ class LegacyExternalProductResourceUrls : ExternalProductResourceUrls {
}
}
}
override val downloadPageUrl: Url
get() = Urls.newFromEncoded(ApplicationInfoEx.getInstanceEx().downloadUrl)
}

View File

@@ -21,7 +21,7 @@
<xs:element type="iconEapType" name="icon-eap" minOccurs="0"/>
<xs:element type="licenseeType" name="licensee" minOccurs="0"/>
<xs:element type="namesType" name="names"/>
<xs:element type="productUrlType" name="productUrl"/>
<xs:element type="productUrlType" name="productUrl" minOccurs="0"/>
<xs:element type="essentialPluginType" name="essential-plugin" minOccurs="0" maxOccurs="unbounded"/>
<xs:element type="welcome-screenType" name="welcome-screen" minOccurs="0">
<xs:annotation>