void (final JComponent @NotNull ... components) { if (components.length == 0) return; doWithDialogWrapper(components[0], dialogWrapper -> { if (dialogWrapper instanceof SettingsDialog || dialogWrapper instanceof SingleConfigurableEditor) { for (Component component : components) { if (component instanceof TextFieldWithHistoryWithBrowseButton) { setPreferredWidthToFitText((TextFieldWithHistoryWithBrowseButton)component); } else if (component instanceof TextFieldWithBrowseButton) { setPreferredWidthToFitText((TextFieldWithBrowseButton)component); } else if (component instanceof JTextField) { setPreferredWidthToFitText((JTextField)component); } } ApplicationManager.getApplication().invokeLater(() -> adjustDialogSizeToFitPreferredSize(dialogWrapper), ModalityState.any()); } }); }