Skip to content

Commit 49bd0e8

Browse files
committed
Dismiss notification when action is clicked
1 parent 75e66b3 commit 49bd0e8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ktfmt_idea_plugin/src/main/java/com/facebook/ktfmt/intellij/InitialConfigurationStartupActivity.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,22 @@ public void runActivity(@NotNull Project project) {
4040
}
4141

4242
private void displayNewUserNotification(Project project, KtfmtSettings settings) {
43-
new Notification(
43+
Notification notification =
44+
new Notification(
4445
NotificationGroupManager.getInstance()
4546
.getNotificationGroup(NOTIFICATION_TITLE)
4647
.getDisplayId(),
4748
NOTIFICATION_TITLE,
4849
"The ktfmt plugin is disabled by default.",
49-
NotificationType.INFORMATION)
50+
NotificationType.INFORMATION);
51+
52+
notification
5053
.addAction(
5154
new AnAction("Enable for This Project") {
5255
@Override
5356
public void actionPerformed(@NotNull AnActionEvent e) {
5457
settings.setEnabled(true);
58+
notification.expire();
5559
}
5660
})
5761
.notify(project);

0 commit comments

Comments
 (0)