From 77dbc7cfb3e32b19639fa85e2a72198e4836fa05 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Tue, 20 Oct 2020 02:14:05 +0300 Subject: [PATCH] [cherry-pick] disable checkbox for automatic commit on cherry-pick when changelists are disabled GitOrigin-RevId: 952faefc0cbb3a263e15a11ced0ea72a9e996268 --- plugins/git4idea/src/git4idea/config/GitVcsPanel.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/config/GitVcsPanel.kt b/plugins/git4idea/src/git4idea/config/GitVcsPanel.kt index af3d5f7d4dad..f7b45bd7e09c 100644 --- a/plugins/git4idea/src/git4idea/config/GitVcsPanel.kt +++ b/plugins/git4idea/src/git4idea/config/GitVcsPanel.kt @@ -22,7 +22,9 @@ import com.intellij.openapi.ui.DialogWrapper import com.intellij.openapi.util.NlsSafe import com.intellij.openapi.util.registry.Registry import com.intellij.openapi.vcs.ProjectLevelVcsManager +import com.intellij.openapi.vcs.changes.ChangeListManager import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager +import com.intellij.openapi.vcs.changes.onChangeListAvailabilityChanged import com.intellij.openapi.vcs.update.AbstractCommonUpdateAction import com.intellij.ui.* import com.intellij.ui.components.JBLabel @@ -302,7 +304,13 @@ internal class GitVcsPanel(private val project: Project) : } } row { - checkBox(cdCommitOnCherryPick) + checkBox(cdCommitOnCherryPick).enableIf(object : ComponentPredicate() { + override fun addListener(listener: (Boolean) -> Unit) { + onChangeListAvailabilityChanged(project, this@GitVcsPanel.disposable!!, false, { listener(invoke()) }) + } + + override fun invoke(): Boolean = ChangeListManager.getInstance(project).areChangeListsEnabled() + }) } row { checkBox(cdAddCherryPickSuffix(project))