From 532d61cfd76b4ad49541bca27e8b29d56ade235f Mon Sep 17 00:00:00 2001 From: Jonathan Lermitage Date: Fri, 5 Jan 2024 14:20:46 +0100 Subject: [PATCH] fix #176 Clicking 'Go to Extra Icons settings' from the notification just throws an error --- CHANGELOG.md | 1 + .../activity/HintNotificationsProjectActivity.java | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a56dde41..65cda88c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 2024.1.2 (WIP) * optimize icons size by ~3% with SVGO 3.2.0. +* fix [#176](https://github.com/jonathanlermitage/intellij-extra-icons-plugin/issues/176): clicking 'Go to Extra Icons settings' from the notification just throws an error. ## 2024.1.1 (2024/01/02) * **INFO**: JetBrains will introduce a new business model for paid/freemium plugins. This model will offer a perpetual license, **allowing users to make a one-time payment for the plugin and use it for a lifetime**. [Get more information here](https://github.com/jonathanlermitage/intellij-extra-icons-plugin/blob/master/docs/LICENSE_FAQ.md#how-to-get-a-lifetime-license). There is no ETA yet. diff --git a/src/main/java/lermitage/intellij/extra/icons/activity/HintNotificationsProjectActivity.java b/src/main/java/lermitage/intellij/extra/icons/activity/HintNotificationsProjectActivity.java index f246a5be..3bfc4e05 100644 --- a/src/main/java/lermitage/intellij/extra/icons/activity/HintNotificationsProjectActivity.java +++ b/src/main/java/lermitage/intellij/extra/icons/activity/HintNotificationsProjectActivity.java @@ -2,12 +2,12 @@ package lermitage.intellij.extra.icons.activity; -import com.intellij.ide.BrowserUtil; import com.intellij.notification.Notification; import com.intellij.notification.NotificationAction; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.options.ShowSettingsUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.ProjectActivity; @@ -20,6 +20,8 @@ import lermitage.intellij.extra.icons.messaging.RefreshIconsNotifierService; import lermitage.intellij.extra.icons.utils.I18nUtils; import lermitage.intellij.extra.icons.utils.IJUtils; +import lermitage.intellij.extra.icons.utils.ProjectUtils; +import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -31,11 +33,17 @@ */ public class HintNotificationsProjectActivity implements ProjectActivity { + private static final @NonNls Logger LOGGER = Logger.getInstance(HintNotificationsProjectActivity.class); + private static final ResourceBundle i18n = I18nUtils.getResourceBundle(); @Nullable @Override public Object execute(@NotNull Project project, @NotNull Continuation continuation) { + if (!ProjectUtils.isProjectAlive(project)) { + LOGGER.info(this.getClass().getName() + " started before project is ready. Will not show startup notifications this time"); + return null; + } SettingsIDEService settingsIDEService = SettingsIDEService.getInstance(); boolean alwaysShowNotifications = System.getProperty("extra-icons.always.show.notifications", "false").equals("true"); //NON-NLS