void (final @NotNull JComponent component, final @NotNull Consumer<? super DialogWrapper> consumer) { UIUtil.invokeLaterIfNeeded(() -> { if (component.getClientProperty(DIALOG_RESIZED_TO_FIT_TEXT) != null) { return; } component.putClientProperty(DIALOG_RESIZED_TO_FIT_TEXT, true); DialogWrapper dialogWrapper = DialogWrapper.findInstance(component); if (dialogWrapper != null) { consumer.consume(dialogWrapper); } else { UiNotifyConnector.doWhenFirstShown(component, () -> { DialogWrapper dialogWrapper1 = DialogWrapper.findInstance(component); if (dialogWrapper1 != null) { consumer.consume(dialogWrapper1); } }); } }); }