From c0987627898419fc2e05f92404fb652a74a0b600 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 15 Mar 2017 18:21:54 +0300 Subject: [PATCH] ui: extract method --- .../com/intellij/openapi/ui/DialogWrapper.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 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 6934d64e91e0..45e13c5d6cbc 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java @@ -455,6 +455,11 @@ public abstract class DialogWrapper { return UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula() || UIUtil.isUnderWin10LookAndFeel(); } + private static boolean isRemoveHelpButton() { + return SystemInfo.isWindows && (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) && Registry.is("ide.win.frame.decoration") || + Registry.is("ide.remove.help.button.from.dialogs"); + } + /** * Creates panel located at the south of the content pane. By default that * panel contains dialog's buttons. This default implementation uses createActions() @@ -471,10 +476,11 @@ public abstract class DialogWrapper { } boolean hasHelpToMoveToLeftSide = false; - if (isMoveHelpButtonLeft() && actions.contains(getHelpAction())) { - hasHelpToMoveToLeftSide = true; + if (isRemoveHelpButton()) { actions.remove(getHelpAction()); - } else if (Registry.is("ide.remove.help.button.from.dialogs")) { + } + else if (isMoveHelpButtonLeft() && actions.contains(getHelpAction())) { + hasHelpToMoveToLeftSide = true; actions.remove(getHelpAction()); } @@ -643,9 +649,7 @@ public abstract class DialogWrapper { JComponent helpButton = null; if (hasHelpToMoveToLeftSide) { - if (!(SystemInfo.isWindows && (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) && Registry.is("ide.win.frame.decoration"))) { - helpButton = createHelpButton(insets); - } + helpButton = createHelpButton(insets); } if (helpButton != null || doNotAskCheckbox != null) {