[python] inline notification group initialization (PY-75446)

GitOrigin-RevId: a3061571c4ad943e7e28abd7d0f08cd55e400c81
This commit is contained in:
Alexander Zolotov
2024-08-24 16:20:03 +02:00
committed by intellij-monorepo-bot
parent 927ebdeddd
commit 2f96b83aa2

View File

@@ -8,7 +8,6 @@ import com.intellij.codeInspection.ex.InspectionProfileImpl;
import com.intellij.codeInspection.ex.InspectionToolWrapper;
import com.intellij.lang.annotation.AnnotationHolder;
import com.intellij.lang.annotation.Annotator;
import com.intellij.notification.NotificationGroup;
import com.intellij.notification.NotificationGroupManager;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
@@ -45,7 +44,6 @@ import java.util.List;
*/
public final class PyCompatibilityInspectionAdvertiser implements Annotator {
private static final NotificationGroup BALLOON_NOTIFICATIONS = NotificationGroupManager.getInstance().getNotificationGroup("Python Compatibility Inspection Advertiser");
private static final Key<Boolean> DONT_SHOW_BALLOON = Key.create("showingPyCompatibilityAdvertiserBalloon");
// Allow to show declined suggestion multiple times to ease debugging
@@ -176,7 +174,8 @@ public final class PyCompatibilityInspectionAdvertiser implements Annotator {
@NotNull @NotificationContent String htmlContent,
@NotNull NotificationListener listener) {
project.putUserData(DONT_SHOW_BALLOON, true);
BALLOON_NOTIFICATIONS.createNotification(title, htmlContent, NotificationType.INFORMATION)
NotificationGroupManager.getInstance().getNotificationGroup("Python Compatibility Inspection Advertiser")
.createNotification(title, htmlContent, NotificationType.INFORMATION)
.setSuggestionType(true)
.setListener((notification, event) -> {
try {