/** * If a database componenet use an existing connection, its label may replace with variable from * the existing connection not the component variable. see bug 0005456: Label Format __DBNAME__ * not valid when using existing connection * * @param text String that contains variables which need to replace * @param variableMap A map contains variable name and IElementParameter in a pair * @return */ public static String replaceWithExistingConnection( String text, Map<String, IElementParameter> variableMap) { if (text == null) { return ""; //$NON-NLS-1$ } String newText = text; for (String var : variableMap.keySet()) { if (newText.contains(var)) { IElementParameter param = variableMap.get(var); String value = ElementParameterParser.getDisplayValue(param); newText = newText.replace(param.getVariableName(), value); } } return newText; }