Second attempt to fix IJPL-172136 Don't mention Freemium around AI Assistant

(cherry picked from commit 70c5dfb6acb9e6f25326f5a76a45e8e7aa0e11a8)

IJ-CR-149964

GitOrigin-RevId: 78bff9b7586159fcee6de02171f7f514d8717c4e
This commit is contained in:
Elena Shaverdova
2024-11-27 16:02:01 +01:00
committed by intellij-monorepo-bot
parent e2c97bb25f
commit 9df9e519d1
3 changed files with 16 additions and 13 deletions

View File

@@ -9,7 +9,6 @@ import com.intellij.ide.plugins.PluginManagerConfigurable;
import com.intellij.ide.plugins.PluginNode;
import com.intellij.openapi.application.IdeUrlTrackingParametersProvider;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.LicensingFacade;
import com.intellij.ui.components.ActionLink;
@@ -157,13 +156,11 @@ public final class LicensePanel extends NonOpaquePanel {
@NotNull Supplier<? extends IdeaPluginDescriptor> getPlugin, boolean forUpdate,
boolean makePanelVisible) {
setText(text, warning, errorColor);
Ref<Boolean> enforceHidingPanel = new Ref<>(null);
showBuyPlugin(getPlugin, forUpdate, enforceHidingPanel);
setVisible(makePanelVisible && !Boolean.TRUE.equals(enforceHidingPanel.get()) );
showBuyPlugin(getPlugin, forUpdate);
setVisible(makePanelVisible);
}
private void showBuyPlugin(@NotNull Supplier<? extends IdeaPluginDescriptor> getPlugin, boolean forUpdate,
@NotNull Ref<Boolean> enforceHidingPanel) {
private void showBuyPlugin(@NotNull Supplier<? extends IdeaPluginDescriptor> getPlugin, boolean forUpdate) {
IdeaPluginDescriptor plugin = getPlugin.get();
setLink(IdeBundle.message("plugins.configurable.buy.the.license"), () ->
@@ -177,9 +174,6 @@ public final class LicensePanel extends NonOpaquePanel {
List<String> tags = ((PluginNode)plugin).getTags();
if (tags.contains(Tags.Freemium.name())) {
updateLink(IdeBundle.message(forUpdate ? "label.plugin.freemium" : "plugins.configurable.activate.trial.for.full.access"), false);
if (forUpdate && "AIP".equals(plugin.getProductCode())) {
enforceHidingPanel.set(Boolean.TRUE);
}
return;
}
}
@@ -198,4 +192,10 @@ public final class LicensePanel extends NonOpaquePanel {
LicensingFacade.getInstance() != null &&
ArrayUtil.contains(productCodeOrPluginId, "DPN", "DC", "DPA", "PDB", "PWS", "PGO", "PPS", "PPC", "PRB", "PSW", "Pythonid");
}
public static boolean shouldSkipPluginLicenseDescriptionPublishing(@NotNull IdeaPluginDescriptor plugin) {
return "AIP".equals(plugin.getProductCode()) &&
(plugin instanceof PluginNode) &&
((PluginNode)plugin).getTags().contains(Tags.Freemium.name());
}
}

View File

@@ -559,7 +559,8 @@ public final class ListPluginComponent extends JPanel {
myVersion.setText(NewUiUtil.getVersion(plugin, descriptor));
}
if (plugin.getProductCode() == null && descriptor.getProductCode() != null &&
!plugin.isBundled() && !LicensePanel.isEA2Product(descriptor.getProductCode())) {
!plugin.isBundled() && !LicensePanel.isEA2Product(descriptor.getProductCode()) &&
!LicensePanel.shouldSkipPluginLicenseDescriptionPublishing(descriptor)) {
if (myUpdateLicensePanel == null) {
myLayout.addLineComponent(myUpdateLicensePanel = new LicensePanel(true));
myUpdateLicensePanel.setBorder(JBUI.Borders.emptyTop(3));

View File

@@ -1239,11 +1239,13 @@ class PluginDetailsPageComponent @JvmOverloads constructor(
return
}
if (productCode == null) {
if (updateDescriptor != null && updateDescriptor!!.productCode != null &&
!LicensePanel.isEA2Product(updateDescriptor!!.productCode)
val update = updateDescriptor
if (update != null && update.productCode != null &&
!LicensePanel.isEA2Product(update.productCode) &&
!LicensePanel.shouldSkipPluginLicenseDescriptionPublishing(update)
) {
licensePanel.showBuyPluginWithText(IdeBundle.message("label.next.plugin.version.is"), true, false,
{ updateDescriptor }, true,
{ update }, true,
true)
}
else {