@NotNull
  public String expandMacros(@NotNull @NonNls String text) {
    int start = text.indexOf("${");
    if (start < 0) return text;
    Map<String, String> macroMap = myMacroMap.getValue();
    Matcher matcher = MACRO_PATTERN.matcher(text);
    StringBuilder sb = null;
    while (matcher.find(start)) {
      String value = macroMap.get(matcher.group(1));
      if (value != null) {
        if (sb == null) sb = new StringBuilder(2 * text.length()).append(text, 0, matcher.start());
        else sb.append(text, start, matcher.start());
        sb.append(value);
        start = matcher.end();
      }
      else {
        if (sb != null) sb.append(text, start, matcher.start() + 2);
        start = matcher.start() + 2;
      }
    }
    return sb == null ? text : sb.append(text, start, text.length()).toString();
  }
@NotNull
  public String expandMacros(@NotNull @NonNls String text)