public UpdateInfoPanel() { ApplicationInfo appInfo = ApplicationInfo.getInstance(); myBuildNumber.setText(appInfo.getBuild().asString() + ")"); final String version = appInfo.getFullVersion(); myVersionNumber.setText(version); myNewBuildNumber.setText(myLatestBuild.getNumber().asString() + ")"); myNewVersionNumber.setText(myLatestBuild.getVersion()); myUpdateMessageLabel.setBackground(UIUtil.getLabelBackground()); myScrollPane.setBackground(UIUtil.getLabelBackground()); myScrollPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); if (myLatestBuild.getMessage() != null) { StringBuilder builder = new StringBuilder(); builder .append("<html><head>") .append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())) .append("</head><body>") .append(StringUtil.formatLinks(myLatestBuild.getMessage())) .append("</body></html>"); myUpdateMessageLabel.setText(builder.toString()); myUpdateMessageLabel.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE); } else { myUpdateMessageLabel.setVisible(false); } PatchInfo patch = myLatestBuild.findPatchForCurrentBuild(); if (patch == null) { myPatchAvailableLabel.setVisible(false); myPatchSizeLabel.setVisible(false); } else { myPatchSizeLabel.setText(patch.getSize() + "MB"); } if (SystemInfo.isMac) { myManualCheckLabel.setText( "<html><br>To check for new updates manually, use the <b>" + ApplicationNamesInfo.getInstance().getProductName() + " | Check for Updates</b> command.</html>"); } LabelTextReplacingUtil.replaceText(myPanel); }
public void testFormatLinks() { assertEquals( "<a href=\"http://a-b+c\">http://a-b+c</a>", StringUtil.formatLinks("http://a-b+c")); }