[platform] update compatibility info in the dialog (ZD-723058)

This commit is contained in:
Roman Shevchenko
2016-07-19 19:03:08 +02:00
parent bf47f4323d
commit b65dcdc5de
5 changed files with 25 additions and 10 deletions
@@ -38,8 +38,6 @@ import java.awt.*;
public abstract class AbstractUpdateDialog extends DialogWrapper {
private final boolean myEnableLink;
protected String myLicenseInfo = null;
protected AbstractUpdateDialog(boolean enableLink) {
super(true);
myEnableLink = enableLink;
@@ -48,6 +48,7 @@ class UpdateChannel(node: Element) {
val status: ChannelStatus = ChannelStatus.fromCode(node.getAttributeValue("status"))
val licensing: String = node.getAttributeValue("licensing", LICENSING_PRODUCTION)
val homePageUrl: String? = node.getAttributeValue("url")
val evalDays: Int = node.getAttributeValue("evalDays")?.toInt() ?: 30
val builds: List<BuildInfo> = node.getChildren("build").map { BuildInfo(it) }
override fun toString() = id
@@ -37,6 +37,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
@@ -56,6 +57,9 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
private final PatchInfo myPatch;
private final boolean myWriteProtected;
private String myLicenseInfo = null;
private Color myLicenseInfoColor = null;
UpdateInfoDialog(@NotNull UpdateChannel channel,
@NotNull BuildInfo newBuild,
@Nullable PatchInfo patch,
@@ -88,12 +92,20 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
}
else {
Date buildDate = build.getReleaseDate();
Date expiration = facade.getLicenseExpirationDate();
if (buildDate != null && facade.isPerpetualForProduct(buildDate)) {
myLicenseInfo = IdeBundle.message("updates.fallback.build");
}
else if (expiration != null && expiration.after(new Date())) {
myLicenseInfo = IdeBundle.message("updates.subscription.active.till", DateFormatUtil.formatAboutDialogDate(expiration));
if (buildDate != null) {
if (!facade.isApplicableForProduct(buildDate)) {
myLicenseInfo = IdeBundle.message("updates.paid.upgrade", channel.getEvalDays());
myLicenseInfoColor = JBColor.RED;
}
else if (facade.isPerpetualForProduct(buildDate)) {
myLicenseInfo = IdeBundle.message("updates.fallback.build");
}
else {
Date expiration = facade.getLicenseExpirationDate();
myLicenseInfo = expiration != null
? IdeBundle.message("updates.interim.build", DateFormatUtil.formatAboutDialogDate(expiration))
: IdeBundle.message("updates.interim.build.endless");
}
}
}
}
@@ -255,7 +267,7 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
}
if (myLicenseInfo != null) {
configureMessageArea(myLicenseArea, myLicenseInfo, null, null);
configureMessageArea(myLicenseArea, myLicenseInfo, myLicenseInfoColor, null);
}
}
}
@@ -38,6 +38,8 @@ public abstract class LicensingFacade {
public abstract boolean isEvaluationLicense();
public abstract boolean isApplicableForProduct(@NotNull Date productBuildDate);
public abstract boolean isPerpetualForProduct(@NotNull Date productBuildDate);
@Nullable
@@ -913,8 +913,10 @@ updates.error.plugin.description.failed=Failed to load plugin descriptions from:
update.notifications.title=Platform and Plugin Updates
update.notifications.group=Platform and Plugin Updates
updates.channel.bundled.key=The new version has an expiration date and does not require a license key.
updates.paid.upgrade=You can evaluate the new version for {0} days, or buy an upgrade online.
updates.fallback.build=You have perpetual fallback license for the new version.
updates.subscription.active.till=Your subscription is active until {0}.
updates.interim.build=You can use the new version until your subscription expires on {0}.
updates.interim.build.endless=You can use the new version until your subscription expires.
updates.ready.message={0} is ready to <a href=\"update\">update</a>.
updates.external.progress=Fetching available updates for external components
updates.external.ready.message=The following component{0,choice,1# is|2#s are} ready to <a href="update">update</a>: {1}