mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
non-modal update dialogs; HTML styling of new channel dialog
This commit is contained in:
+15
-4
@@ -18,7 +18,10 @@ package com.intellij.openapi.updateSettings.impl;
|
||||
import com.intellij.ide.BrowserUtil;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.ui.BrowserHyperlinkListener;
|
||||
import com.intellij.ui.LicensingFacade;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -52,7 +55,7 @@ public class NewChannelDialog extends DialogWrapper {
|
||||
}
|
||||
};
|
||||
if (myShowUpgradeButton) {
|
||||
Action upgrade = new AbstractAction("Upgrade Online") {
|
||||
Action upgrade = new AbstractAction("Buy Upgrade Online") {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
LicensingFacade facade = LicensingFacade.getInstance();
|
||||
@@ -68,18 +71,26 @@ public class NewChannelDialog extends DialogWrapper {
|
||||
|
||||
@Override
|
||||
protected JComponent createCenterPanel() {
|
||||
return new JLabel(myInformationText);
|
||||
JEditorPane pane = new JEditorPane("text/html", myInformationText);
|
||||
pane.addHyperlinkListener(new BrowserHyperlinkListener());
|
||||
pane.setEditable(false);
|
||||
return new JBScrollPane(pane);
|
||||
}
|
||||
|
||||
private void initInfo() {
|
||||
StringBuilder builder = new StringBuilder().append("<html><b>").append(myChannel.getName()).append("</b><br>");
|
||||
StringBuilder builder = new StringBuilder().append("<html>");
|
||||
builder.append("<head>").append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())).append("</head><body>");
|
||||
builder.append("<b>").append(myChannel.getName()).append("</b><br>");
|
||||
builder.append(myChannel.getLatestBuild().getMessage()).append("<br><br>");
|
||||
LicensingFacade facade = LicensingFacade.getInstance();
|
||||
if (facade != null) {
|
||||
if (!myChannel.getLicensing().equals(UpdateChannel.LICENSING_EAP)) {
|
||||
Boolean paidUpgrade = facade.isPaidUpgrade(myChannel.getMajorVersion(), myChannel.getLatestBuild().getReleaseDate());
|
||||
if (paidUpgrade != null) {
|
||||
if (paidUpgrade) {
|
||||
builder.append("The new version requires upgrading your license key.");
|
||||
builder.append("You can evaluate the new version for ")
|
||||
.append(myChannel.getEvalDays())
|
||||
.append(" days or buy a license key or an upgrade online.");
|
||||
myShowUpgradeButton = true;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -34,6 +34,7 @@ public class UpdateChannel {
|
||||
private final String myHomePageUrl;
|
||||
private final String myFeedbackUrl;
|
||||
private final List<BuildInfo> myBuilds;
|
||||
private final int myEvalDays;
|
||||
|
||||
public static final String LICENSING_EAP = "eap";
|
||||
public static final String LICENSING_PRODUCTION = "production";
|
||||
@@ -48,6 +49,9 @@ public class UpdateChannel {
|
||||
String majorVersion = node.getAttributeValue("majorVersion");
|
||||
myMajorVersion = majorVersion != null ? Integer.parseInt(majorVersion) : -1;
|
||||
|
||||
String evalDays = node.getAttributeValue("evalDays");
|
||||
myEvalDays = evalDays != null ? Integer.parseInt(evalDays) : 30;
|
||||
|
||||
myHomePageUrl = node.getAttributeValue("url");
|
||||
myFeedbackUrl = node.getAttributeValue("feedback");
|
||||
|
||||
@@ -96,4 +100,8 @@ public class UpdateChannel {
|
||||
public String getLicensing() {
|
||||
return myLicensing;
|
||||
}
|
||||
|
||||
public int getEvalDays() {
|
||||
return myEvalDays;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -314,10 +314,14 @@ public final class UpdateChecker {
|
||||
final boolean alwaysShowResults) {
|
||||
UpdateChannel channelToPropose = checkForUpdateResult.getChannelToPropose();
|
||||
if (channelToPropose != null && channelToPropose.getLatestBuild() != null) {
|
||||
new NewChannelDialog(channelToPropose).show();
|
||||
NewChannelDialog dialog = new NewChannelDialog(channelToPropose);
|
||||
dialog.setModal(alwaysShowResults);
|
||||
dialog.show();
|
||||
}
|
||||
else if (checkForUpdateResult.hasNewBuildInSelectedChannel()) {
|
||||
new UpdateInfoDialog(true, checkForUpdateResult.getUpdatedChannel(), updatedPlugins, enableLink).show();
|
||||
UpdateInfoDialog dialog = new UpdateInfoDialog(true, checkForUpdateResult.getUpdatedChannel(), updatedPlugins, enableLink);
|
||||
dialog.setModal(alwaysShowResults);
|
||||
dialog.show();
|
||||
}
|
||||
else if (updatedPlugins != null || alwaysShowResults) {
|
||||
NoUpdatesDialog dialog = new NoUpdatesDialog(true, updatedPlugins, enableLink);
|
||||
|
||||
Reference in New Issue
Block a user