[github] Add gap between filename and discussions icon in changes tree

GitOrigin-RevId: cad94839e100d141c518c77023aec888907f5588
This commit is contained in:
Pavel Gromov
2023-03-10 13:41:54 +00:00
committed by intellij-monorepo-bot
parent 2529ce409d
commit d1de79d3a2
@@ -1,17 +1,14 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.collaboration.ui.codereview
import com.intellij.openapi.editor.colors.FontPreferences.DEFAULT_FONT_NAME
import com.intellij.openapi.editor.colors.FontPreferences.DEFAULT_FONT_SIZE
import com.intellij.openapi.util.NlsSafe
import com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode
import com.intellij.ui.CellRendererPanel
import com.intellij.ui.ColoredTreeCellRenderer
import com.intellij.util.ui.JBUI.Borders.emptyRight
import com.intellij.util.ui.JBUI
import icons.CollaborationToolsIcons
import java.awt.BorderLayout
import java.awt.Component
import java.awt.Font
import javax.swing.Icon
import javax.swing.JLabel
import javax.swing.JTree
@@ -22,8 +19,7 @@ internal class CodeReviewProgressRenderer(
private val codeReviewProgressStateProvider: (ChangesBrowserNode<*>) -> NodeCodeReviewProgressState
) : CellRendererPanel(), TreeCellRenderer {
private val iconLabel = JLabel().apply { border = emptyRight(10) }
private val discussionsCountFont = Font(DEFAULT_FONT_NAME, Font.PLAIN, DEFAULT_FONT_SIZE)
private val iconLabel = JLabel().apply { border = JBUI.Borders.empty(0, TEXT_ICON_GAP, 0, ICON_BORDER) }
init {
buildLayout()
@@ -76,4 +72,9 @@ internal class CodeReviewProgressRenderer(
require(discussionsCount > 0)
return if (!isRead) CollaborationToolsIcons.Review.CommentUnread else CollaborationToolsIcons.Review.CommentUnresolved
}
companion object {
private const val TEXT_ICON_GAP = 4
private const val ICON_BORDER = 10
}
}