From 132009a22f6a98261492ddfea7f9aa8cf7d9918e Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Tue, 22 Oct 2019 20:21:32 +0300 Subject: [PATCH] vcs: non-modal: Make commit button panel use same background as commit message editor GitOrigin-RevId: eec5eb5ac1cb3d84dc30e0b0f9df2822a0e35abe --- .../com/intellij/vcs/commit/ChangesViewCommitPanel.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/vcs/commit/ChangesViewCommitPanel.kt b/platform/vcs-impl/src/com/intellij/vcs/commit/ChangesViewCommitPanel.kt index 2e1131512123..e5db568ae7cc 100644 --- a/platform/vcs-impl/src/com/intellij/vcs/commit/ChangesViewCommitPanel.kt +++ b/platform/vcs-impl/src/com/intellij/vcs/commit/ChangesViewCommitPanel.kt @@ -6,6 +6,7 @@ import com.intellij.openapi.MnemonicHelper import com.intellij.openapi.actionSystem.* import com.intellij.openapi.editor.colors.EditorColorsListener import com.intellij.openapi.editor.colors.EditorColorsScheme +import com.intellij.openapi.editor.ex.EditorEx import com.intellij.openapi.project.DumbAwareAction import com.intellij.openapi.ui.ComponentContainer import com.intellij.openapi.ui.Messages @@ -59,7 +60,6 @@ import javax.swing.border.EmptyBorder import kotlin.properties.Delegates.observable private val DEFAULT_COMMIT_ACTION_SHORTCUT = CustomShortcutSet(getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK)) -private val BACKGROUND_COLOR = JBColor { getTreeBackground() } private val isCompactCommitLegend = Registry.get("vcs.non.modal.commit.legend.compact") @@ -126,7 +126,7 @@ class ChangesViewCommitPanel(private val changesView: ChangesListView, private v } private val commitButton = object : JBOptionButton(defaultCommitAction, emptyArray()) { init { - background = BACKGROUND_COLOR + background = getButtonPanelBackground() optionTooltipText = getDefaultTooltip() isOkToProcessDefaultMnemonics = false } @@ -176,13 +176,13 @@ class ChangesViewCommitPanel(private val changesView: ChangesListView, private v private fun buildLayout() { buttonPanel.apply { - background = BACKGROUND_COLOR + background = getButtonPanelBackground() border = getButtonPanelBorder() addToLeft(commitActionToolbar.component) addToCenter( createHorizontalPanel().apply { - background = BACKGROUND_COLOR + background = getButtonPanelBackground() add(NonOpaquePanel(HorizontalLayout(scale(4))).apply { add(commitButton) @@ -225,6 +225,9 @@ class ChangesViewCommitPanel(private val changesView: ChangesListView, private v private fun getButtonPanelBorder(): Border = EmptyBorder(0, scale(4), (scale(6) - commitButton.getBottomInset()).coerceAtLeast(0), 0) + private fun getButtonPanelBackground() = + JBColor { (commitMessage.editorField.editor as? EditorEx)?.backgroundColor ?: getTreeBackground() } + private fun inclusionChanged() { updateLegend() }