mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: implement a red status dot on the toolwindow stripe button for non-modal merge conflicts (IJPL-175262)
GitOrigin-RevId: b5effa8c4eb3bb16067dfceed908b52e43e05443
This commit is contained in:
committed by
intellij-monorepo-bot
parent
209944aeaf
commit
1a82af9448
@@ -9,6 +9,7 @@ import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||
import com.intellij.openapi.actionSystem.toolbarLayout.ToolbarLayoutStrategy
|
||||
import com.intellij.openapi.vcs.VcsBundle
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesListView
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManagerListener
|
||||
import com.intellij.openapi.vcs.merge.ChangesViewConflictsBanner
|
||||
import com.intellij.openapi.vcs.merge.MergeConflictManager
|
||||
import com.intellij.ui.ScrollPaneFactory.createScrollPane
|
||||
@@ -87,6 +88,9 @@ class ChangesViewPanel(val changesView: ChangesListView, parentDisposable: Dispo
|
||||
else {
|
||||
conflictsBanner.close()
|
||||
}
|
||||
ChangeListManager.getInstance(project).invokeAfterUpdate(true) {
|
||||
project.getMessageBus().syncPublisher(ChangesViewContentManagerListener.TOPIC).toolWindowMappingChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
-1
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.vcs.changes.ui
|
||||
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.ide.IdeBundle
|
||||
import com.intellij.ide.actions.ToolWindowEmptyStateAction.rebuildContentUi
|
||||
import com.intellij.ide.trustedProjects.TrustedProjects
|
||||
@@ -9,10 +10,15 @@ import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager
|
||||
import com.intellij.openapi.vcs.merge.MergeConflictManager
|
||||
import com.intellij.openapi.wm.ToolWindow
|
||||
import com.intellij.openapi.wm.ex.ToolWindowEx
|
||||
import com.intellij.ui.IconManager
|
||||
import com.intellij.ui.JBColor
|
||||
import com.intellij.util.ui.JBUI
|
||||
import com.intellij.util.ui.StatusText
|
||||
import java.util.function.Supplier
|
||||
import javax.swing.UIManager
|
||||
|
||||
private class ChangeViewToolWindowFactory : VcsToolWindowFactory() {
|
||||
private val shouldShowWithoutActiveVcs = Registry.get("vcs.empty.toolwindow.show")
|
||||
@@ -85,4 +91,23 @@ private class CommitToolWindowFactory : VcsToolWindowFactory() {
|
||||
rebuildContentUi(toolWindow)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateState(toolWindow: ToolWindow) {
|
||||
super.updateState(toolWindow)
|
||||
|
||||
val project = toolWindow.project
|
||||
when {
|
||||
!toolWindow.isAvailable || !MergeConflictManager.isNonModalMergeEnabled(project) -> return
|
||||
!MergeConflictManager.getInstance(project).isMergeConflict() -> toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowCommit)
|
||||
else -> {
|
||||
val focusColor = UIManager.getColor("ToolWindow.Button.selectedForeground")
|
||||
val originalIcon = toolWindow.icon
|
||||
if (originalIcon != null) {
|
||||
val badgeColor = JBColor { if (toolWindow.isActive) focusColor else JBUI.CurrentTheme.IconBadge.ERROR }
|
||||
val badgeIcon = IconManager.getInstance().withIconBadge(originalIcon, badgeColor)
|
||||
toolWindow.setIcon(badgeIcon)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user