/** * Parses the text for special variables. */ protected String parseText(String string_to_parse) { string_to_parse = installData.getVariables().replace(string_to_parse); return string_to_parse; }
/** * Translates a relative path to a local system path. * * @param destination the path to translate * @param variables used to replaces variables in the path * @return the translated path */ public static String translatePath(String destination, Variables variables) { destination = variables.replace(destination); return translatePath(destination); }
/** * Replaces any variables in the supplied value. * * @param value the value * @return the value with variables replaced */ protected String replaceVariables(String value) { return installData.getVariables().replace(value); }
/** * @return the suggested program group */ public String getSuggestedProgramGroup() { return installData.getVariables().replace(suggestedProgramGroup); }
/** * Parses the text for special variables. */ private void parseText() { // Parses the info text info = installData.getVariables().replace(info); }
/** * Translates a relative path to a local system path. * * @param destination The path to translate. * @return The translated path. */ protected String translatePath(String destination) { // Parse for variables destination = installData.getVariables().replace(destination); // Convert the file separator characters return destination.replace('/', File.separatorChar); } }
/** * Translates a relative path to a local system path. * * @param destination The path to translate. * @return The translated path. */ private String translatePath(String destination) { // Parse for variables destination = installData.getVariables().replace(destination); // Convert the file separator characters return destination.replace('/', File.separatorChar); } }
/** * Shows and updates the description text in the panel * * @param id */ public void updateDescriptionArea(String id) { if (descriptionArea != null) { Pack pack = namesToPacks.get(id); String desc = PackHelper.getPackDescription(pack, messages); desc = installData.getVariables().replace(desc); descriptionArea.setText(desc); } }
/** * Runs the panel using the supplied properties. * * @param installData the installation data * @param properties the properties * @return {@code true} if the installation is successful, otherwise {@code false} */ @Override public boolean run(InstallData installData, Properties properties) { String path = properties.getProperty(InstallData.INSTALL_PATH); path = installData.getVariables().replace(path); installData.setInstallPath(path); return true; }
@Override public boolean isTrue() { InstallData installData = getInstallData(); if (installData != null) { String val = installData.getVariable(variablename); if (val == null) { return false; } else { Variables variables = installData.getVariables(); return variables.replace(val).equals(variables.replace(value)); } } else { return false; } }
/** * Helper to replace variables in a string. * * @param value the string to perform variable replacement on. May be {@code null} * @return the string with any variables replaced with their values */ protected String replaceVariables(String value) { return getInstallData().getVariables().replace(value); }
private void handleInstallPath(InstallData installData, String path) { // Allow for variable substitution of the installpath value path = installData.getVariables().replace(path); installData.setInstallPath(path); } }
/** * Returns the named attribute value, replacing any variables present. * * @param element the element * @param name the attribute name * @param defaultValue the default value if the attribute isn't set * @return the corresponding value */ public String getString(IXMLElement element, String name, String defaultValue) { String value = element.getAttribute(name); if (value != null && !value.isEmpty()) { value = installData.getVariables().replace(value); } if (value == null) { value = defaultValue; } return value; }
@Override public boolean run(InstallData installData, Properties properties) { boolean result = false; String path = properties.getProperty(InstallData.INSTALL_PATH); if (path == null || "".equals(path.trim())) { System.err.println("Missing mandatory target path!"); } else if (TargetPanelHelper.isIncompatibleInstallation(path, installData.getInfo().isReadInstallationInformation())) { System.err.println(getIncompatibleInstallationMsg(installData)); } else { path = installData.getVariables().replace(path); installData.setInstallPath(path); result = true; } return result; }
@Override public void runAutomated(InstallData idata, IXMLElement panelRoot) { // We set the installation path IXMLElement ipath = panelRoot.getFirstChildNamed(UserPathPanel.pathElementName); // Allow for variable substitution of the installpath value if (ipath != null) { String path = ipath.getContent(); path = idata.getVariables().replace(path); idata.setVariable(UserPathPanel.pathVariableName, path); } }
/** * Helper to return a localised message, given its id. * * @param id the message identifier * @param replace if {@code true}, replace any variables in the message with their corresponding values * @return the corresponding message or {@code null} if none is found */ private String getMessage(String id, boolean replace) { String message = null; if (id != null) { Messages messages = installData.getMessages(); message = messages.get(id); if (replace) { message = installData.getVariables().replace(message); } } return message; }
@Override public String getTitle() { // Use a alternate message if defined. final String key = "installer.reversetitle"; Messages messages = installdata.getMessages(); String message = messages.get(key); // message equal to key -> no message defined. if (message.equals(key)) { message = messages.get("installer.title") + " " + installdata.getInfo().getAppName(); } else { // Attention! The alternate message has to contain the whole message including // $APP_NAME and may be $APP_VER. message = installdata.getVariables().replace(message); } return message; }
value = variables.replace(value);
private void handleInstallPath(InstallData installData, String path) { // Allow for variable substitution of the installpath value path = installData.getVariables().replace(path); if (TargetPanelHelper.isIncompatibleInstallation(path, installData.getInfo().isReadInstallationInformation())) { throw new InstallerException(installData.getMessages().get("TargetPanel.incompatibleInstallation")); } installData.setInstallPath(path); } }
/** * Returns the default value of the field. * * @return the default value. May be {@code null} */ @Override public String getDefaultValue() { String value = super.getDefaultValue(); if (value != null) { ValidationStatus status = validateFormatted(value); this.defaultValues = status.isValid()?status.getValues():null; } else { // Maybe an unresolved variable, for example <spec default="${abc}"/> this.defaultValues = null; } if (defaultValues != null) { return getInstallData().getVariables().replace(format(defaultValues)); } return null; }