mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow products to customize default script name for 'Create Launcher Script' dialog (IDEA-CR-13319)
This commit is contained in:
@@ -38,6 +38,7 @@ public class ApplicationNamesInfo {
|
||||
private String myFullProductName;
|
||||
private String myLowercaseProductName;
|
||||
private String myScriptName;
|
||||
private String myDefaultLauncherName;
|
||||
|
||||
private static class ApplicationNamesInfoHolder {
|
||||
private static final ApplicationNamesInfo ourInstance = new ApplicationNamesInfo();
|
||||
@@ -66,6 +67,7 @@ public class ApplicationNamesInfo {
|
||||
myFullProductName = names.getAttributeValue(ATTRIBUTE_FULL_NAME);
|
||||
myLowercaseProductName = StringUtil.capitalize(myProductName.toLowerCase(Locale.US));
|
||||
myScriptName = names.getAttributeValue(ATTRIBUTE_SCRIPT);
|
||||
myDefaultLauncherName = names.getAttributeValue("default-launcher-name", myScriptName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,6 +101,13 @@ public class ApplicationNamesInfo {
|
||||
return myScriptName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return default name of the command-line launcher to be suggested in 'Create Launcher Script' dialog
|
||||
*/
|
||||
public String getDefaultLauncherName() {
|
||||
return myDefaultLauncherName;
|
||||
}
|
||||
|
||||
public static String getComponentName() {
|
||||
String prefix = System.getProperty(PlatformUtils.PLATFORM_PREFIX_KEY);
|
||||
return prefix != null ? prefix + COMPONENT_NAME : COMPONENT_NAME;
|
||||
|
||||
@@ -164,7 +164,7 @@ public class CreateLauncherScriptAction extends DumbAwareAction {
|
||||
}
|
||||
|
||||
public static String defaultScriptPath() {
|
||||
String scriptName = ApplicationNamesInfo.getInstance().getScriptName();
|
||||
String scriptName = ApplicationNamesInfo.getInstance().getDefaultLauncherName();
|
||||
if (StringUtil.isEmptyOrSpaces(scriptName)) scriptName = ApplicationNamesInfo.getInstance().getProductName().toLowerCase(Locale.US);
|
||||
return "/usr/local/bin/" + scriptName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user