remove unused NavBarItemPresentation.selectedTextAttributes

GitOrigin-RevId: 158ec0d0cb8f038105458767e9adfd98bc6b12d2
This commit is contained in:
Daniil Ovchinnikov
2024-03-20 20:54:27 +00:00
committed by intellij-monorepo-bot
parent ff444631b2
commit 2e6cd387a9
3 changed files with 8 additions and 18 deletions
@@ -137,7 +137,7 @@ internal class ServiceViewRootNavBarItem(
override val presentation: NavBarItemPresentation = NavBarItemPresentation(
AllIcons.Nodes.Services, "", null,
REGULAR_ATTRIBUTES,
REGULAR_ATTRIBUTES, false
false
)
override suspend fun children(): List<NavBarVmItem> {
@@ -170,7 +170,7 @@ private class ServiceViewNavBarItem(
override val presentation: NavBarItemPresentation = run {
val icon = item.getViewDescriptor().getPresentation().getIcon(false)
val text = ServiceViewDragHelper.getDisplayName(item.getViewDescriptor().getPresentation())
NavBarItemPresentation(icon, text, null, REGULAR_ATTRIBUTES, REGULAR_ATTRIBUTES, false)
NavBarItemPresentation(icon, text, null, REGULAR_ATTRIBUTES, false)
}
override suspend fun children(): List<NavBarVmItem> {
@@ -2,7 +2,6 @@
package com.intellij.ide.navbar
import com.intellij.ui.SimpleTextAttributes
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.Nls
import javax.swing.Icon
@@ -31,13 +30,6 @@ class NavBarItemPresentation(
*/
val textAttributes: SimpleTextAttributes,
/**
* Not used, tobe deleted
*/
@ApiStatus.ScheduledForRemoval
@Deprecated("not used, to be deleted")
val selectedTextAttributes: SimpleTextAttributes,
/**
* Find better place for that.
* Currently used as one more criteria to show item's icon
@@ -58,8 +58,7 @@ open class DefaultNavBarItem<out T>(val data: T) : NavBarItem {
val text: String = fromOldExtensions { ext -> ext.getPresentableText(data, false) } ?: getText(false)
val popupText: String = fromOldExtensions { ext -> ext.getPresentableText(data, true) } ?: getText(true)
val textAttributes = getTextAttributes(selected = false)
val selectedTextAttributes = getTextAttributes(selected = true)
val textAttributes = getTextAttributes()
val hasContainingFile = (data as? PsiElement)?.containingFile != null
@@ -68,7 +67,6 @@ open class DefaultNavBarItem<out T>(val data: T) : NavBarItem {
text,
popupText,
textAttributes,
selectedTextAttributes,
hasContainingFile
)
}
@@ -77,7 +75,7 @@ open class DefaultNavBarItem<out T>(val data: T) : NavBarItem {
open fun getText(forPopup: Boolean): @Nls String = data.toString()
open fun getTextAttributes(selected: Boolean): SimpleTextAttributes = REGULAR_ATTRIBUTES
open fun getTextAttributes(): SimpleTextAttributes = REGULAR_ATTRIBUTES
}
@@ -90,7 +88,7 @@ internal class ProjectNavBarItem(data: Project) : DefaultNavBarItem<Project>(dat
override fun getIcon(): Icon = AllIcons.Nodes.Project
override fun getTextAttributes(selected: Boolean): SimpleTextAttributes {
override fun getTextAttributes(): SimpleTextAttributes {
val problemSolver = WolfTheProblemSolver.getInstanceIfCreated(data) ?: return REGULAR_ATTRIBUTES
val hasProblems = ModuleManager.getInstance(data)
.modules
@@ -122,7 +120,7 @@ internal class ModuleNavBarItem(data: Module) : DefaultNavBarItem<Module>(data),
override fun getIcon(): Icon = ModuleType.get(data).icon
override fun getTextAttributes(selected: Boolean): SimpleTextAttributes {
override fun getTextAttributes(): SimpleTextAttributes {
val problemSolver = WolfTheProblemSolver.getInstance(data.project)
val hasProblems = problemSolver.hasProblemFilesBeneath(data)
@@ -159,14 +157,14 @@ internal class PsiNavBarItem(data: PsiElement, val ownerExtension: NavBarModelEx
null
}
override fun getTextAttributes(selected: Boolean): SimpleTextAttributes {
override fun getTextAttributes(): SimpleTextAttributes {
val psiFile = data.containingFile
if (psiFile != null) {
val virtualFile = psiFile.virtualFile ?: return SimpleTextAttributes(null, null, navBarErrorAttributes.waveColor, STYLE_PLAIN)
val problemSolver = WolfTheProblemSolver.getInstance(data.project)
val style = if (problemSolver.isProblemFile(virtualFile)) navBarErrorAttributes.style else STYLE_PLAIN
val color = if (!selected) FileStatusManager.getInstance(data.project).getStatus(virtualFile).color else null
val color = FileStatusManager.getInstance(data.project).getStatus(virtualFile).color
return SimpleTextAttributes(null, color, navBarErrorAttributes.waveColor, style)
}
else {