From 02b2823c2226df18123fc4d74ad89951d4ee55e4 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Fri, 23 Sep 2016 15:39:58 +0300 Subject: [PATCH] ui: change south panel layout * fix case with both "left actions" and "do not ask again" options * fix case with both "compact" and "do not ask again" options * better vertical alignment of "do not ask again" checkbox --- .../intellij/openapi/ui/DialogWrapper.java | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) 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");