Is it possible to clear all EditorNotificationPanel notifications programatically?

Answered

There's a persistent notification appearing in the Editor Panel that I'd like to ignore and dismiss. Is it possible to somehow hook into the EditorNotificationPanel via a custom plugin and dismiss all active notifications?

I've been able to find support articles mentioning how to post new notifications to this panel but not modify the notifications that are already there.

0
3 comments

Which notification is it, maybe there is a specific way to suppress it?

 

A general way would be:

JComponent old = editor.getUserData(key);
if (old != null) {
FileEditorManager.getInstance(myProject).removeTopComponent(editor, old);
}

where key == com.intellij.ui.EditorNotifications.Provider#getKey matching the NotificationProvider you want to remove.

0
Avatar
Permanently deleted user

We have a custom sync mechanism that allows us to safely ignore this editor notification that pops up:



I'm trying to build a plugin that will clear out this notification so it's not cluttering the Editor window for our developers. The problem is, I'm not sure what the key would be since it's not a notification we control (likely coming from the Gradle plugin).

Is there a way for me to grab a list of running notifications so I can figure out what the key would be for this particular notification? If so, I can find the key and use the logic you posted to clear it out. Or, potentially clearing all Editor Notifications instead?

0

AFAIU this is coming from Android plugin com.android.tools.idea.gradle.notification.ProjectSyncStatusNotificationProvider with key

Key.create("android.gradle.sync.status")

 

One way to find out about responsible plugin is to use UI inspector and find the implementation class of the Panel component https://www.jetbrains.org/intellij/sdk/docs/reference_guide/internal_actions/internal_uii.html

0

Please sign in to leave a comment.