public static String getValue(final IElement node, final String text) {
    String newText = new String(""); // $NON-NLS-1$
    if (text == null) {
      return newText;
    }
    IElementParameter param = null;
    boolean end = false;

    List<IElementParameter> params =
        (List<IElementParameter>) node.getElementParametersWithChildrens();
    if (params != null && !params.isEmpty()) {
      for (int i = 0; i < params.size() && !end; i++) {
        param = params.get(i);
        if (text.indexOf(param.getVariableName()) != -1) {
          newText = getDisplayValue(param);
          end = true;
        }
      }
    }
    // see feature 3725 replace tMsgBox MESSAGE parameter
    if (node instanceof INode) {
      INode valueNode = (INode) node;
      /*
       * Apply to all components in Perl mode
       */
      if (isPerlProject()) {
        return PerlVarParserUtils.findAndReplacesAll(newText, valueNode);
      }
    }

    return newText;
  }
  public static String parse(final IElement element, final String text) {
    String newText = ""; // $NON-NLS-1$
    if ((element == null) || (text == null)) {
      return newText;
    }
    IElementParameter param;

    newText = text;
    for (int i = 0; i < element.getElementParameters().size(); i++) {
      param = element.getElementParameters().get(i);
      if (newText.contains(param.getVariableName())) {
        String value = getDisplayValue(param);
        newText = newText.replace(param.getVariableName(), value);
      }
    }
    return newText;
  }
  /**
   * Only work with one element.
   *
   * @param element
   * @param text
   * @return
   */
  public static Object getObjectValue(final IElement element, final String text) {
    if (text == null) {
      return null;
    }
    IElementParameter param;

    List<IElementParameter> params =
        (List<IElementParameter>) element.getElementParametersWithChildrens();
    if (params != null && !params.isEmpty()) {
      for (int i = 0; i < params.size(); i++) {
        param = params.get(i);
        if (text.indexOf(param.getVariableName()) != -1
            || (param.getVariableName() != null && param.getVariableName().contains(text))) {
          if (param.getFieldType() == EParameterFieldType.TABLE) {
            return createTableValues((List<Map<String, Object>>) param.getValue(), param);
          }
          return param.getValue();
        }
      }
    }
    return null;
  }
  /**
   * 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;
  }
  /**
   * Only work with one element.
   *
   * @param element
   * @param text
   * @return
   */
  public static Object getObjectValueXML(final IElement element, final String text) {
    if (text == null) {
      return null;
    }
    IElementParameter param;

    for (int i = 0; i < element.getElementParameters().size(); i++) {
      param = element.getElementParameters().get(i);
      if (text.indexOf(param.getVariableName()) != -1) {
        if (param.getFieldType() == EParameterFieldType.TABLE) {
          return createTableValuesXML((List<Map<String, Object>>) param.getValue(), param);
        }
        return param.getValue();
      }
    }
    return null;
  }