private static @NotNull Pair<@NotNull String, @Nullable String> getAddedAtStacktrace(@NotNull Component component) {
    Throwable throwable = null;
    String propertyName = "added-at";
    String text;
    int first;
    if (component instanceof JComponent c) {
      throwable = (Throwable)c.getClientProperty(DslComponentPropertyInternal.CREATION_STACKTRACE);
    }

    if (throwable == null) {
      throwable = ClientProperty.get(component, UiInspectorAction.ADDED_AT_STACKTRACE);
      if (throwable == null) {
        return new Pair<>(propertyName, null);
      }

      text = ExceptionUtil.getThrowableText(throwable);
      first = text.indexOf("at com.intellij", text.indexOf("at java."));
    }
    else {
      propertyName = "added-at (UI DSL)";
      text = ExceptionUtil.getThrowableText(throwable);
      first = text.indexOf("at com.intellij");
    }

    int last = text.indexOf("at java.awt.EventQueue");
    if (last == -1) last = text.length();
    return new Pair<>(propertyName, last > first && first > 0 ? text.substring(first, last).trim() : null);
  }
private static @NotNull Pair<@NotNull String, @Nullable String> getAddedAtStacktrace(@NotNull Component component)