License support: fix bugs in LicensePanel, evaluation feedback support for RubyMine, minor changes in messages (due to Toporov's requests)

This commit is contained in:
Ekaterina Shliakhovetskaja
2010-04-12 00:21:11 +04:00
parent 437da281d5
commit d005977a7b
4 changed files with 45 additions and 28 deletions
@@ -39,10 +39,8 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.*;
import java.util.List;
import java.util.Properties;
public class AboutAction extends AnAction implements DumbAware {
@NonNls private static final String COMPANY_URL = "http://www.jetbrains.com/"; // TODO move to ApplicationInfo.xml
@@ -103,7 +101,8 @@ public class AboutAction extends AnAction implements DumbAware {
final long delta = Patches.APPLE_BUG_ID_3716865 ? 100 : 0;
dialog.addWindowFocusListener(new WindowFocusListener() {
public void windowGainedFocus(WindowEvent e) {}
public void windowGainedFocus(WindowEvent e) {
}
public void windowLostFocus(WindowEvent e) {
long eventTime = System.currentTimeMillis();
@@ -184,12 +183,17 @@ public class AboutAction extends AnAction implements DumbAware {
Calendar cal = ideInfo.getBuildDate();
myLines.add(new AboutBoxLine(ideInfo.getFullApplicationName(), true, false));
myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.build.number", ideInfo.getBuild().asString())));
myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.build.date", DateFormat.getDateInstance(DateFormat.LONG).format(cal.getTime()))));
myLines
.add(new AboutBoxLine(IdeBundle.message("aboutbox.build.date", DateFormat.getDateInstance(DateFormat.LONG).format(cal.getTime()))));
myLines.add(new AboutBoxLine(""));
LicenseeInfoProvider provider = LicenseeInfoProvider.getInstance();
if (provider != null) {
myLines.add(new AboutBoxLine(provider.getLicensedToMessage(), true, false));
myLines.add(new AboutBoxLine(provider.getLicenseRestrictionsMessage()));
final Date mdd = provider.getMaintenanceDueDate();
if (mdd != null) {
myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.maintenance.due", mdd)));
}
}
myLines.add(new AboutBoxLine(""));
@@ -198,6 +202,7 @@ public class AboutAction extends AnAction implements DumbAware {
myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.jdk", properties.getProperty("java.version", "unknown")), true, false));
myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.vm", properties.getProperty("java.vm.name", "unknown"))));
myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.vendor", properties.getProperty("java.vendor", "unknown"))));
}
myLines.add(new AboutBoxLine(""));
myLines.add(new AboutBoxLine("JetBrains s.r.o.", true, false));
@@ -215,7 +220,7 @@ public class AboutAction extends AnAction implements DumbAware {
if (
event.getPoint().x > linkX && event.getPoint().y >= linkY &&
event.getPoint().x < linkX + linkWidth && event.getPoint().y < linkY + 10
) {
) {
if (!inLink) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
inLink = true;
@@ -245,9 +250,9 @@ public class AboutAction extends AnAction implements DumbAware {
TextRenderer renderer = new TextRenderer(0, 145, 398, 120, g2);
g2.setComposite(AlphaComposite.Src);
myFont = labelFont.deriveFont(Font.PLAIN, labelSize);
myBoldFont = labelFont.deriveFont(Font.BOLD, labelSize+1);
myBoldFont = labelFont.deriveFont(Font.BOLD, labelSize + 1);
try {
renderer.render (75, 0, myLines);
renderer.render(75, 0, myLines);
break;
}
catch (TextRenderer.OverflowException _) {
@@ -270,7 +275,8 @@ public class AboutAction extends AnAction implements DumbAware {
private int fontHeight;
private Font font;
public class OverflowException extends Exception { }
public class OverflowException extends Exception {
}
public TextRenderer(final int xBase, final int yBase, final int w, final int h, final Graphics2D g2) {
this.xBase = xBase;
@@ -280,12 +286,11 @@ public class AboutAction extends AnAction implements DumbAware {
this.g2 = g2;
if (SystemInfo.isWindows) {
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
public void render(int indentX, int indentY, List<AboutBoxLine> lines) throws OverflowException {
x = indentX;
y = indentY;
@@ -293,20 +298,20 @@ public class AboutAction extends AnAction implements DumbAware {
for (int i = 0; i < lines.size(); i++) {
AboutBoxLine line = lines.get(i);
final String s = line.getText();
setFont (line.isBold() ? myBoldFont : myFont);
setFont(line.isBold() ? myBoldFont : myFont);
if (line.isLink()) {
g2.setColor(linkCol);
linkX = x;
linkY = yBase + y - fontAscent;
FontMetrics metrics = g2.getFontMetrics(font);
linkWidth = metrics.stringWidth (s);
linkWidth = metrics.stringWidth(s);
}
renderString(s, indentX);
if (i == lines.size()-2) {
if (i == lines.size() - 2) {
x += 50;
}
else if (i < lines.size()-1) {
lineFeed (indentX, s);
else if (i < lines.size() - 1) {
lineFeed(indentX, s);
}
}
}
@@ -331,7 +336,7 @@ public class AboutAction extends AnAction implements DumbAware {
}
private void renderWord(final String s, final int indentX) throws OverflowException {
for (int j = 0; j != s.length(); ++ j) {
for (int j = 0; j != s.length(); ++j) {
final char c = s.charAt(j);
final int cW = fontmetrics.charWidth(c);
if (x + cW >= w) {
@@ -345,19 +350,20 @@ public class AboutAction extends AnAction implements DumbAware {
private void lineFeed(int indent, final String s) throws OverflowException {
x = indent;
if (s.length() == 0) {
y += fontHeight/3;
y += fontHeight / 3;
}
else {
y += fontHeight;
}
if (y >= h)
if (y >= h) {
throw new OverflowException();
}
}
private void setFont(Font font) {
this.font = font;
fontmetrics = g2.getFontMetrics(font);
g2.setFont (font);
fontmetrics = g2.getFontMetrics(font);
g2.setFont(font);
fontAscent = fontmetrics.getAscent();
fontHeight = fontmetrics.getHeight();
}
@@ -16,6 +16,9 @@
package com.intellij.ui;
import com.intellij.openapi.components.ServiceManager;
import org.jetbrains.annotations.Nullable;
import java.util.Date;
/**
* @author yole
@@ -28,4 +31,9 @@ public abstract class LicenseeInfoProvider {
public abstract String getLicensedToMessage();
public abstract String getLicenseRestrictionsMessage();
public abstract boolean isEvaluationLicense();
@Nullable
public Date getMaintenanceDueDate(){
return null;
}
}
@@ -255,7 +255,7 @@ error.license.collision=This license is being used elsewhere on the network by {
title.license.collision.detected=License Collision Detected
message.licensed.to=Licensed to {0}
title.enter.license.data=Enter License Data
message.purchase.or.upgrade=To purchase {0}, refer to {1}.<br>To upgrade from a previous version, refer to {2}.
message.purchase.or.upgrade=For information on how to upgrade your evaluation software please go to {0}
message.expiration.date=Expiration date: {0}
message.educational.license=1-Year Educational License. {0}
message.open.source.project.license=Open Source Project License. {0}
@@ -266,10 +266,11 @@ aboutbox.build.date=Built on {0}
aboutbox.jdk=JDK: {0}
aboutbox.vm=VM: {0}
aboutbox.vendor=Vendor: {0}
aboutbox.maintenance.due=Entitled for free updates and upgrades until {0,date,MMMM dd,yyyy}
title.warning=Warning
message.upgrade.from.previous.required={0} requires an upgrade from previous versions.<br>You can purchase a license key from the JetBrains website at<br>{1}
message.upgrade.from.previous.required=Your license is not valid for use with this version of {0}. <br/> For information on how to upgrade your license please go to {1}
title.upgrade.needed=Upgrade Needed
message.evaluation.has.expired=The evaluation license has expired. Your session will be limited to 30 minutes.<br>{0}
message.evaluation.has.expired=Your {0} evaluation has expired. Your session will be limited to 30 minutes.<br>{1}
title.evaluation.license.expired=Evaluation License Expired
message.license.expired=Your license has expired
title.license.expired=License Expired
@@ -288,7 +289,8 @@ error.saving.license.data=Error saving license data.\n{0}
title.unable.to.save.data=Unable to Save Data
link.click.here.to.license.server.info=More info
link.purchase.commercial.license=To purchase a commercial license, please visit
license.panel.current.license.description=The license will expire on {0,date,MMMM dd, yyyy}
license.panel.expirable.license.description=The license will expire on {0,date,MMMM dd, yyyy}
license.panel.maintenance.aware.license.description=Entitled for free updates and upgrades until {0,date,MMMM dd, yyyy}
license.panel.current.permanent.ticket.description=Permanent ticket obtained
license.panel.current.floating.ticket.description=Floating ticket obtained
license.panel.buildit.evaluation.expires.in.one=1 day left
@@ -713,7 +715,7 @@ prompt.select.module.file.to.import=Select {0} module file (.iml) to import
message.module.file.has.an.older.format.do.you.want.to.convert.it=Module file has an older format. Do you want to convert it?
dialog.title.convert.module=Convert Module
error.message.cannot.modify.file.0=Cannot modify file ''{0}''
message.your.module.was.succesfully.converted.br.old.version.was.saved.to.0=<html><body>Your module was succesfully converted. <br>\
message.your.module.was.succesfully.converted.br.old.version.was.saved.to.0=<html><body>Your module was successfully converted. <br>\
Old version was saved to ''{0}''</body></html>
label.select.module.type=Module type:
error.please.specify.path.to.module.file=Please specify path to {0} module file (.iml)
@@ -6,7 +6,7 @@
<p>It's been ### days since you started evaluating, and your opinion is really valuable to us.
<ul>
<li>If you have any technical questions that you would like to ask</li>
<li>If you would like to tell us about the things you love/hate about IntelliJ IDEA</li>
<li>If you would like to tell us about the things you love/hate about </li>
<li>If you have questions about licensing or purchasing</li>
</ul>
Just click the <strong>Submit Feedback</strong> button, and we'll get back to you super fast.<br>
@@ -16,4 +16,5 @@ You can use the <strong>Help | Submit Feedback</strong> menu item at any time la
<p align="right"><em>The JetBrains Team</em>
</td></tr></table></body>
</html>
</html>