Turns out you need to create an instance of NotificationGroup and then use it to create Notifications and pass the notification and Project Notifications.Bus.notify ().
public class VoiceApplicationComponentImpl implements ApplicationComponent, VoiceApplicationComponent { ... public static final NotificationGroup GROUP_DISPLAY_ID_INFO = new NotificationGroup("My notification group", NotificationDisplayType.BALLOON, true); ... void showMyMessage(String message) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { Notification notification = GROUP_DISPLAY_ID_INFO.createNotification(message, NotificationType.ERROR); Project[] projects = ProjectManager.getInstance().getOpenProjects(); Notifications.Bus.notify(notification, projects[0]); } }); }
Note: you will probably have a better way to get the current project, for now I just assume there is one open project. This means that my method does not work at startup (the array of projects is empty).
Another note: you probably wonβt need to wrap invokeLater, but I did it because I was calling showMyMessage in another thread.
Verdagon
source share