IJPL-166332 Avoid showing repeated notifications about Floating License Server connectivity problem

(cherry picked from commit 1b237a3de797b3061428b2ce762cd5204807d90b)

IJ-CR-149110

GitOrigin-RevId: 6f781b89ea1abb7440cd5630afa3b71622761918
This commit is contained in:
Alexander Lobas
2024-11-11 15:41:43 +01:00
committed by intellij-monorepo-bot
parent 135cebec97
commit c7b8a4c6ab
3 changed files with 19 additions and 2 deletions

View File

@@ -689,6 +689,7 @@ c:com.intellij.notification.Notification
- isExpired():Z
- isImportant():Z
- isImportantSuggestion():Z
- isRemoveWhenExpired():Z
- isSuggestionType():Z
- notify(com.intellij.openapi.project.Project):V
- setBalloon(com.intellij.openapi.ui.popup.Balloon):V
@@ -703,6 +704,7 @@ c:com.intellij.notification.Notification
- setImportantSuggestion(Z):com.intellij.notification.Notification
- setListener(com.intellij.notification.NotificationListener):com.intellij.notification.Notification
- setRemindLaterHandlerId(java.lang.String):com.intellij.notification.Notification
- setRemoveWhenExpired(Z):com.intellij.notification.Notification
- setSubtitle(java.lang.String):com.intellij.notification.Notification
- setSuggestionType(Z):com.intellij.notification.Notification
- setTitle(java.lang.String):com.intellij.notification.Notification

View File

@@ -71,6 +71,7 @@ public class Notification {
private @Nullable Boolean myImportant;
private boolean mySuggestionType;
private boolean myImportantSuggestion;
private boolean myRemoveWhenExpired;
private String myDoNotAskId;
private @Nls String myDoNotAskDisplayName;
private boolean myIsShowingPopupSuppressed;
@@ -121,6 +122,16 @@ public class Notification {
return this;
}
public boolean isRemoveWhenExpired() {
return myRemoveWhenExpired;
}
@Contract(value = "_ -> this", mutates = "this")
public @NotNull Notification setRemoveWhenExpired(boolean removeWhenExpired) {
myRemoveWhenExpired = removeWhenExpired;
return this;
}
/**
* Returns the time (in milliseconds since Jan 1, 1970) when the notification was created.
*/

View File

@@ -702,7 +702,7 @@ private class NotificationGroupComponent(private val myMainContent: Notification
for (i in 0 until count) {
val component = myList.getComponent(i) as NotificationComponent
if (component.myNotificationWrapper.notification === notification) {
if (notification.isSuggestionType) {
if (notification.isSuggestionType || notification.isRemoveWhenExpired) {
component.removeFromParent()
myList.remove(i)
}
@@ -1668,7 +1668,11 @@ internal class ApplicationNotificationModel {
fun getNotifications(project: Project?): List<Notification> {
synchronized(myLock) {
if (project == null) {
return ArrayList(myNotifications)
val result = ArrayList(myNotifications)
for ((_, eachModel) in myProjectToModel.entries) {
result.addAll(eachModel.getNotifications(emptyList()))
}
return result
}
val model = myProjectToModel[project]
if (model == null) {