mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
application info: added method to get short company name which can be used in UI and directory names
This commit is contained in:
@@ -48,7 +48,7 @@ class ApplicationInfoProperties {
|
||||
companyName = root.company.first().@name
|
||||
minorVersionMainPart = minorVersion.takeWhile { it != '.' }
|
||||
isEAP = Boolean.parseBoolean(root.version.first().@eap)
|
||||
shortCompanyName = StringUtil.trimEnd(companyName, "s.r.o.").trim()
|
||||
shortCompanyName = root.company.first().@shortName ?: shortenCompanyName(companyName)
|
||||
}
|
||||
|
||||
public String getUpperCaseProductName() { shortProductName.toUpperCase() }
|
||||
@@ -56,4 +56,9 @@ class ApplicationInfoProperties {
|
||||
public String getFullVersion() {
|
||||
MessageFormat.format(fullVersionFormat, majorVersion, minorVersion, microVersion, patchVersion)
|
||||
}
|
||||
|
||||
//copy of ApplicationInfoImpl.shortenCompanyName
|
||||
private static String shortenCompanyName(String name) {
|
||||
return StringUtil.trimEnd(StringUtil.trimEnd(name, " s.r.o."), " Inc.");
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,20 @@ public abstract class ApplicationInfo {
|
||||
public abstract String getPatchVersion();
|
||||
public abstract String getVersionName();
|
||||
public abstract String getHelpURL();
|
||||
|
||||
/**
|
||||
* Use this method to refer to the company in official contexts where it may have any legal implications.
|
||||
* @see #getShortCompanyName()
|
||||
* @return full name of the product vendor, e.g. 'JetBrains s.r.o.' for JetBrains products
|
||||
*/
|
||||
public abstract String getCompanyName();
|
||||
|
||||
/**
|
||||
* Use this method to refer to the company in a less formal way, e.g. in UI messages or directory names.
|
||||
* @see #getCompanyName()
|
||||
* @return shortened name of the product vendor without 'Inc.' or similar suffixes, e.g. 'JetBrains' for JetBrains products
|
||||
*/
|
||||
public abstract String getShortCompanyName();
|
||||
public abstract String getCompanyURL();
|
||||
public abstract String getThirdPartySoftwareURL();
|
||||
public abstract String getJetbrainsTvUrl();
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PlatformUtils {
|
||||
|
||||
public static boolean isJetBrainsProduct() {
|
||||
final ApplicationInfo appInfo = ApplicationInfo.getInstance();
|
||||
return appInfo != null && appInfo.getCompanyName().contains("JetBrains");
|
||||
return appInfo != null && appInfo.getShortCompanyName().equals("JetBrains");
|
||||
}
|
||||
|
||||
public static boolean isIntelliJ() {
|
||||
|
||||
@@ -57,6 +57,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx {
|
||||
private String myBuildNumber;
|
||||
private String myApiVersion;
|
||||
private String myCompanyName = "JetBrains s.r.o.";
|
||||
private String myShortCompanyName;
|
||||
private String myCompanyUrl = "https://www.jetbrains.com/";
|
||||
private Color myProgressColor;
|
||||
private Color myCopyrightForeground = JBColor.BLACK;
|
||||
@@ -320,6 +321,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx {
|
||||
return "jar:file:///" + getHelpJarPath() + "!/" + myHelpRootName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortCompanyName() {
|
||||
return myShortCompanyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCompanyName() {
|
||||
return myCompanyName;
|
||||
@@ -635,6 +641,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx {
|
||||
Element companyElement = parentNode.getChild(ELEMENT_COMPANY);
|
||||
if (companyElement != null) {
|
||||
myCompanyName = companyElement.getAttributeValue(ATTRIBUTE_NAME, myCompanyName);
|
||||
myShortCompanyName = companyElement.getAttributeValue("shortName", shortenCompanyName(myCompanyName));
|
||||
myCompanyUrl = companyElement.getAttributeValue(ATTRIBUTE_URL, myCompanyUrl);
|
||||
}
|
||||
|
||||
@@ -924,6 +931,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx {
|
||||
}
|
||||
}
|
||||
|
||||
//copy of ApplicationInfoProperties.shortenCompanyName
|
||||
private static String shortenCompanyName(String name) {
|
||||
return StringUtil.trimEnd(StringUtil.trimEnd(name, " s.r.o."), " Inc.");
|
||||
}
|
||||
|
||||
private static void setBuildNumber(String apiVersion, String buildNumber) {
|
||||
PluginManagerCore.BUILD_NUMBER = apiVersion != null ? apiVersion : buildNumber;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user