Skip to content

Commit

Permalink
Dismiss notification when action is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
rock3r committed Aug 7, 2024
1 parent 75e66b3 commit 49bd0e8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,22 @@ public void runActivity(@NotNull Project project) {
}

private void displayNewUserNotification(Project project, KtfmtSettings settings) {
new Notification(
Notification notification =
new Notification(
NotificationGroupManager.getInstance()
.getNotificationGroup(NOTIFICATION_TITLE)
.getDisplayId(),
NOTIFICATION_TITLE,
"The ktfmt plugin is disabled by default.",
NotificationType.INFORMATION)
NotificationType.INFORMATION);

notification
.addAction(
new AnAction("Enable for This Project") {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
settings.setEnabled(true);
notification.expire();
}
})
.notify(project);
Expand Down

0 comments on commit 49bd0e8

Please sign in to comment.