Reputation: 191
I am trying to modify a custom intellij plugin to improve notification management.
I want to send notification to a Banner, however I found the doc really hard to use to achieve this. https://plugins.jetbrains.com/docs/intellij/notifications.html#editor-banner There is no code example.
Does anyone knows how to do that ?
Thx
Upvotes: 1
Views: 114
Reputation: 5
I know this is old but maybe it is of use to some people...
I used this to have a banner at the top of my toolwindow (Also includes an action which has to implement AnAction:
class BannerPanel(
private val action: AnAction,
) : EditorNotificationPanel(Status.Warning) {
init {
text = "Your Warning"
createActionLabel("ActionText") {
val actionManager = ActionManager.getInstance()
actionManager.tryToExecute(action, null, null, null, true)
}
}
}
In the ToolWindow I added it via:
class ToolWindow : SimpleToolWindowPanel(false),
{
init {
val bannerPanel = BannerPanel(YourAction())
add(bannerPanel, BorderLayout.NORTH)
}
}
And you can set visibility with:
bannerPanel.isVisible = false
Upvotes: 0