void (@NotNull Project project) { MessageBusConnection busConnection = project.getMessageBus().connect(); busConnection.subscribe(BuildManagerListener.TOPIC, new BuildManagerListener() { @Override public void buildFinished(@NotNull Project project, @NotNull UUID sessionId, boolean isAutomake) { busConnection.disconnect(); final Notification notification = new Notification( "Build Profiler", JavaCompilerBundle.message("notification.title.cpu.snapshot.build.has.been.captured"), "", NotificationType.INFORMATION ); notification.addAction(new DumbAwareAction(JavaCompilerBundle.message("action.show.snapshot.location.text")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { RevealFileAction.openDirectory(new File(SystemProperties.getUserHome(), "Snapshots")); notification.expire(); } }); Notifications.Bus.notify(notification, project); } }); }