mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
IDEA-295555 Add null checks for PredefinedIconOverlayService
GitOrigin-RevId: c70a8b62313c78c6fa756bdff961e9a891c2f8d9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0e966247ae
commit
8e6c2bc064
@@ -3,6 +3,7 @@ package com.intellij.ui.icons
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.components.serviceOrNull
|
||||
import org.jetbrains.annotations.ApiStatus.Internal
|
||||
import javax.swing.Icon
|
||||
|
||||
@@ -11,6 +12,9 @@ interface PredefinedIconOverlayService {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getInstance(): PredefinedIconOverlayService = ApplicationManager.getApplication().service()
|
||||
|
||||
@JvmStatic
|
||||
fun getInstanceOrNull(): PredefinedIconOverlayService? = ApplicationManager.getApplication().serviceOrNull()
|
||||
}
|
||||
|
||||
fun createSymlinkIcon(icon: Icon): Icon
|
||||
|
||||
@@ -573,7 +573,7 @@ private fun computeFileIconImpl(file: VirtualFile, project: Project?, flags: Int
|
||||
}
|
||||
}
|
||||
if (file.`is`(VFileProperty.SYMLINK)) {
|
||||
icon = PredefinedIconOverlayService.getInstance().createSymlinkIcon(icon)
|
||||
icon = PredefinedIconOverlayService.getInstanceOrNull()?.createSymlinkIcon(icon) ?: icon
|
||||
}
|
||||
if (BitUtil.isSet(flags, Iconable.ICON_FLAG_READ_STATUS) &&
|
||||
Registry.`is`("ide.locked.icon.enabled", false) &&
|
||||
|
||||
@@ -242,7 +242,10 @@ public abstract class AbstractPsiBasedNode<Value> extends ProjectViewNode<Value>
|
||||
Icon icon = original;
|
||||
|
||||
if (file.is(VFileProperty.SYMLINK)) {
|
||||
icon = PredefinedIconOverlayService.getInstance().createSymlinkIcon(icon);
|
||||
PredefinedIconOverlayService iconOverlayService = PredefinedIconOverlayService.getInstanceOrNull();
|
||||
if (iconOverlayService != null) {
|
||||
icon = iconOverlayService.createSymlinkIcon(icon);
|
||||
}
|
||||
}
|
||||
|
||||
Icon bookmarkIcon = getBookmarkIcon(project, file);
|
||||
|
||||
Reference in New Issue
Block a user