Notification Balloon not shown, weird scenario

Hey, I am not getting the notification balloon, but I get the Event Logs. Below is the code of the Action class.

void actionPerformed(AnActionEvent e) {         Notifications.Bus.register(GROUP_NOTIFICATION_ID, NotificationDisplayType.BALLOON)         Notifications.Bus.notify(new Notification(GROUP_NOTIFICATION_ID, 'Title', 'Description', NotificationType.WARNING))         Notifications.Bus.notify(new Notification(GROUP_NOTIFICATION_ID, 'Title', 'Description', NotificationType.INFORMATION))         Notifications.Bus.notify(new Notification(GROUP_NOTIFICATION_ID, 'Title', 'Description', NotificationType.ERROR))         final EntryDialog dialog = new EntryDialog(e.project)         dialog.show()         Notifications.Bus.notify(new Notification(GROUP_NOTIFICATION_ID, 'Title 1', 'Description 1', NotificationType.ERROR)) }


It's a groovy class. The first 3 notifications before the dialog.show() works. But for the last notification balloon doesn't show up, though I get the event logs. The EntryDialog extends DialogWrapper and has just 2 text fields.

I just found out the work around while typing this post :). If I run on another thread, then the balloon shows up.

ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {             @Override             public void run() {                 Notifications.Bus.notify(new Notification(GROUP_NOTIFICATION_ID, 'Title 1', 'Description 1', NotificationType.ERROR))             } })


Can anyone tell me what's wrong ? What's wrong with the main thread, where am I going wrong ?

I am using Windows 7
IntelliJ iDEA 13.0.2 CE

4 comments
Comment actions Permalink

If EntryDialog is modal dialog (or DialowWrapper, it means the same), your next line

Notifications.Bus.notify(new Notification(GROUP_NOTIFICATION_ID, 'Title 1', 'Description 1', NotificationType.ERROR))


will be executed only afrer dialog disposing.
There is essential documentation about modality: http://docs.oracle.com/javase/tutorial/uiswing/misc/modality.html

0
Comment actions Permalink

But, even after the dialog is disposed, I am not getting the popup... But I am getting the "Event Logs".
Currently, during such situations, I am showing the Notification popup in a separate thread.

0
Comment actions Permalink

Also you can try to call notification within SwingUtilities.invokeLater()
It's just another workaround, maybe misbehavior you've described is really caused by our bug.

0
Comment actions Permalink

Same issue here. Any idea how to fix it?

0

Please sign in to leave a comment.