mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[api] NotificationGroupManagerImpl is not part of platform API
GitOrigin-RevId: 7b8409537fd307a841f8d2b03ff600271d8478d4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0db65f1144
commit
beecfea203
@@ -329,12 +329,6 @@ f:com.intellij.notification.impl.NotificationGroupEP
|
||||
- getDisplayName(com.intellij.openapi.extensions.PluginDescriptor):java.lang.String
|
||||
- getDisplayType():com.intellij.notification.NotificationDisplayType
|
||||
- setPluginDescriptor(com.intellij.openapi.extensions.PluginDescriptor):V
|
||||
f:com.intellij.notification.impl.NotificationGroupManagerImpl
|
||||
- com.intellij.notification.NotificationGroupManager
|
||||
- getNotificationGroup(java.lang.String):com.intellij.notification.NotificationGroup
|
||||
- getRegisteredNotificationGroups():java.util.Collection
|
||||
- isGroupRegistered(java.lang.String):Z
|
||||
- isRegisteredNotificationId(java.lang.String):Z
|
||||
f:com.intellij.notification.impl.NotificationParentGroupBean
|
||||
- id:java.lang.String
|
||||
- parentId:java.lang.String
|
||||
|
||||
@@ -7,30 +7,22 @@ import com.intellij.notification.NotificationGroupManager
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.extensions.ExtensionPointListener
|
||||
import com.intellij.openapi.extensions.PluginDescriptor
|
||||
import com.intellij.util.concurrency.SynchronizedClearableLazy
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
private val LOG = logger<NotificationGroupManagerImpl>()
|
||||
|
||||
class NotificationGroupManagerImpl private constructor() : NotificationGroupManager {
|
||||
private val registeredGroups = computeGroups()
|
||||
internal class NotificationGroupManagerImpl() : NotificationGroupManager {
|
||||
private val registeredGroups: MutableMap<String, NotificationGroup> = computeGroups()
|
||||
|
||||
private val registeredNotificationIds = SynchronizedClearableLazy<Set<String>> {
|
||||
val result = HashSet<String>()
|
||||
NotificationGroupEP.EP_NAME.processWithPluginDescriptor { extension, pluginDescriptor ->
|
||||
if (extension.notificationIds != null && PluginManagerCore.isDevelopedByJetBrains(pluginDescriptor)) {
|
||||
result.addAll(extension.notificationIds!!)
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
@Volatile
|
||||
private var registeredNotificationIds: Set<String>? = null
|
||||
|
||||
init {
|
||||
NotificationGroupEP.EP_NAME.addExtensionPointListener(object : ExtensionPointListener<NotificationGroupEP> {
|
||||
override fun extensionAdded(extension: NotificationGroupEP, pluginDescriptor: PluginDescriptor) {
|
||||
registerNotificationGroup(extension, pluginDescriptor, registeredGroups)
|
||||
if (extension.notificationIds != null) {
|
||||
registeredNotificationIds.drop()
|
||||
registeredNotificationIds = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,19 +32,33 @@ class NotificationGroupManagerImpl private constructor() : NotificationGroupMana
|
||||
registeredGroups.remove(extension.id)
|
||||
}
|
||||
if (extension.notificationIds != null) {
|
||||
registeredNotificationIds.drop()
|
||||
registeredNotificationIds = null
|
||||
}
|
||||
}
|
||||
}, null)
|
||||
}
|
||||
|
||||
private fun getNotificationIds(): Set<String> {
|
||||
val existing = registeredNotificationIds
|
||||
if (existing != null) return existing
|
||||
|
||||
val result = HashSet<String>()
|
||||
NotificationGroupEP.EP_NAME.processWithPluginDescriptor { extension, pluginDescriptor ->
|
||||
if (extension.notificationIds != null && PluginManagerCore.isDevelopedByJetBrains(pluginDescriptor)) {
|
||||
result.addAll(extension.notificationIds!!)
|
||||
}
|
||||
}
|
||||
registeredNotificationIds = result
|
||||
return result
|
||||
}
|
||||
|
||||
override fun getNotificationGroup(groupId: String): NotificationGroup? = registeredGroups[groupId]
|
||||
|
||||
override fun isGroupRegistered(groupId: String): Boolean = registeredGroups.containsKey(groupId)
|
||||
|
||||
override fun getRegisteredNotificationGroups(): MutableCollection<NotificationGroup> = registeredGroups.values
|
||||
|
||||
override fun isRegisteredNotificationId(notificationId: String): Boolean = registeredNotificationIds.value.contains(notificationId)
|
||||
override fun isRegisteredNotificationId(notificationId: String): Boolean = getNotificationIds().contains(notificationId)
|
||||
}
|
||||
|
||||
private fun computeGroups(): MutableMap<String, NotificationGroup> {
|
||||
|
||||
Reference in New Issue
Block a user