private static String smartAbbreviate(String category) {
    if (category == null) return null;

    StringBuilder result = new StringBuilder();
    int pos = 0, nextDot;
    if (category.startsWith("#")) {
      result.append('#');
      pos++;
    }
    if (!(category.startsWith("com.intellij", pos) || category.startsWith("com.jetbrains", pos) || category.startsWith("org.jetbrains", pos))) {
      return category;
    }
    while ((nextDot = category.indexOf('.', pos)) >= 0) {
      result.append(category.charAt(pos)).append('.');
      pos = nextDot + 1;
    }
    result.append(category.substring(pos));
    return result.toString();
  }
private static String smartAbbreviate(String category)