diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java index a47fa1a3dbad..5f505f113aa1 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java @@ -568,24 +568,6 @@ public abstract class DialogWrapper { return false; } - @NotNull - private static JPanel addDoNotShowCheckBox(@NotNull JComponent southPanel, @NotNull JComponent checkBox, @Nullable JComponent helpButton) { - final JPanel panel = new JPanel(new BorderLayout()); - - JPanel wrapper = new JPanel(new GridBagLayout()); - wrapper.add(checkBox); - panel.add(wrapper, BorderLayout.WEST); - panel.add(southPanel, BorderLayout.EAST); - checkBox.setBorder(JBUI.Borders.emptyRight(20)); - - if (helpButton != null) { - return JBUI.Panels.simplePanel(panel).addToLeft(helpButton); - } - else { - return panel; - } - } - @NotNull private List createButtons(@NotNull List actions) { List buttons = new ArrayList<>(); @@ -642,23 +624,31 @@ public abstract class DialogWrapper { if (hasHelpToMoveToLeftSide) { if (!(SystemInfo.isWindows && (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) && Registry.is("ide.win.frame.decoration"))) { helpButton = createHelpButton(insets); - panel.add(helpButton, BorderLayout.WEST); } } - panel.add(lrButtonsPanel, BorderLayout.CENTER); - if (doNotAsk != null) { myCheckBoxDoNotShowDialog = new JCheckBox(doNotAsk.getDoNotShowMessage()); myCheckBoxDoNotShowDialog.setVisible(doNotAsk.canBeHidden()); myCheckBoxDoNotShowDialog.setSelected(!doNotAsk.isToBeShown()); DialogUtil.registerMnemonic(myCheckBoxDoNotShowDialog, '&'); } - JComponent doNotAskCheckbox = createDoNotAskCheckbox(); - if (doNotAskCheckbox != null) { - panel = addDoNotShowCheckBox(panel, doNotAskCheckbox, helpButton); + + + if (helpButton != null || doNotAskCheckbox != null) { + JPanel leftPanel = new JPanel(new BorderLayout()); + + if (helpButton != null) leftPanel.add(helpButton, BorderLayout.WEST); + + if (doNotAskCheckbox != null) { + doNotAskCheckbox.setBorder(JBUI.Borders.emptyRight(20)); + leftPanel.add(doNotAskCheckbox, BorderLayout.CENTER); + } + + panel.add(leftPanel, BorderLayout.WEST); } + panel.add(lrButtonsPanel, BorderLayout.CENTER); if (getStyle() == DialogStyle.COMPACT) { final Color color = UIManager.getColor("DialogWrapper.southPanelDivider");