IDEA-241445 SingletonNotificationManager should be created only once

GitOrigin-RevId: 5afac5de82dffad30b7552ab945169b42bbf5f32
This commit is contained in:
Dmitry.Krasilschikov
2020-06-17 21:02:00 +03:00
committed by intellij-monorepo-bot
parent d8be2e428e
commit 889e23cc6a
@@ -42,6 +42,10 @@ public class TerminalShellCommandHandlerHelper {
private volatile Boolean myHasRunningCommands;
private PropertiesComponent myPropertiesComponent;
private final SingletonNotificationManager myNotificationManager =
new SingletonNotificationManager(NotificationGroup.toolWindowGroup("Terminal", TerminalToolWindowFactory.TOOL_WINDOW_ID),
NotificationType.INFORMATION, null);
TerminalShellCommandHandlerHelper(@NotNull ShellTerminalWidget widget) {
myWidget = widget;
myAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, widget);
@@ -88,17 +92,15 @@ public class TerminalShellCommandHandlerHelper {
if (result != null) {
String title = TerminalBundle.message("smart_command_execution.notification.title");
String content = TerminalBundle.message("smart_command_execution.notification.text", GOT_IT);
new SingletonNotificationManager(
NotificationGroup.toolWindowGroup("Terminal", TerminalToolWindowFactory.TOOL_WINDOW_ID), NotificationType.INFORMATION, null)
.notify(title, content, project,
new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
if (GOT_IT.equals(e.getDescription())) {
getPropertiesComponent().setValue(TERMINAL_CUSTOM_COMMANDS_GOT_IT, true, false);
}
}
});
myNotificationManager.notify(title, content, project,
new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
if (GOT_IT.equals(e.getDescription())) {
getPropertiesComponent().setValue(TERMINAL_CUSTOM_COMMANDS_GOT_IT, true, false);
}
}
});
}
}