From df650f4d54af8d29e69ca4b249ceefe8efd2fa4d Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Wed, 6 Jun 2018 00:22:56 +0300 Subject: [PATCH] vcs: Make commit options in project settings focusable --- .../openapi/vcs/changes/ui/BooleanCommitOption.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/BooleanCommitOption.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/BooleanCommitOption.kt index c35126a71bc5..18a71ef02435 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/BooleanCommitOption.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/BooleanCommitOption.kt @@ -1,12 +1,13 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes.ui +import com.intellij.ide.ui.UISettings import com.intellij.openapi.options.UnnamedConfigurable import com.intellij.openapi.vcs.CheckinProjectPanel import com.intellij.openapi.vcs.checkin.CheckinHandlerUtil.disableWhenDumb import com.intellij.openapi.vcs.configurable.CommitOptionsConfigurable import com.intellij.openapi.vcs.ui.RefreshableOnComponent -import com.intellij.ui.NonFocusableCheckBox +import com.intellij.ui.components.JBCheckBox import java.util.function.Consumer import javax.swing.JComponent @@ -15,8 +16,9 @@ open class BooleanCommitOption(private val checkinPanel: CheckinProjectPanel, disableWhenDumb: Boolean, private val getter: () -> Boolean, private val setter: Consumer) : RefreshableOnComponent, UnnamedConfigurable { - protected val checkBox = NonFocusableCheckBox(text).also { - if (disableWhenDumb && !isInSettings) disableWhenDumb(checkinPanel.project, it, "Impossible until indices are up-to-date") + protected val checkBox = JBCheckBox(text).apply { + isFocusable = isInSettings || UISettings.shadowInstance.disableMnemonicsInControls + if (disableWhenDumb && !isInSettings) disableWhenDumb(checkinPanel.project, this, "Impossible until indices are up-to-date") } private val isInSettings get() = checkinPanel is CommitOptionsConfigurable.CheckinPanel