diff options
author | Siva Velusamy <vsiva@google.com> | 2013-07-01 09:29:56 -0700 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2013-07-01 09:35:47 -0700 |
commit | d0942f10c5abd490ed4387327a84a310599a6560 (patch) | |
tree | 3e6b7697ee93764eb3f206b220e0e0594c09fd53 /platform | |
parent | dcdbd627d78f97c964e1f0046864cb1fc53078fe (diff) | |
download | idea-d0942f10c5abd490ed4387327a84a310599a6560.tar.gz |
Show Notifications on EDT
Change-Id: Id25f740886334157ba260c1f5bfd8634c71fd2e9
Diffstat (limited to 'platform')
-rw-r--r-- | platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemIdeNotificationManager.java | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemIdeNotificationManager.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemIdeNotificationManager.java index 1adf63a91840..937718f37894 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemIdeNotificationManager.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemIdeNotificationManager.java @@ -39,7 +39,7 @@ public class ExternalSystemIdeNotificationManager { public void processExternalProjectRefreshError(@NotNull String message, @NotNull final Project project, @NotNull String externalProjectName, - @NotNull ProjectSystemId externalSystemId) + @NotNull final ProjectSystemId externalSystemId) { ExternalSystemManager<?,?,?,?,?> manager = ExternalSystemApiUtil.getManager(externalSystemId); if (!(manager instanceof ExternalSystemConfigurableAware)) { @@ -47,17 +47,28 @@ public class ExternalSystemIdeNotificationManager { } final Configurable configurable = ((ExternalSystemConfigurableAware)manager).getConfigurable(project); - EditorNotifications.getInstance(project).updateAllNotifications(); - String title = ExternalSystemBundle.message("notification.project.refresh.fail.description", - externalSystemId.getReadableName(), externalProjectName, message); - String messageToShow = ExternalSystemBundle.message("notification.action.show.settings", externalSystemId.getReadableName()); - showNotification(title, messageToShow, NotificationType.WARNING, project, externalSystemId, new NotificationListener() { + if (project != null) { + EditorNotifications editorNotifications = EditorNotifications.getInstance(project); + if (editorNotifications != null) { + editorNotifications.updateAllNotifications(); + } + } + + final String title = ExternalSystemBundle.message("notification.project.refresh.fail.description", externalSystemId.getReadableName(), + externalProjectName, message); + final String messageToShow = ExternalSystemBundle.message("notification.action.show.settings", externalSystemId.getReadableName()); + ExternalSystemApiUtil.executeOnEdt(false, new Runnable() { @Override - public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { - if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) { - return; - } - ShowSettingsUtil.getInstance().editConfigurable(project, configurable); + public void run() { + showNotification(title, messageToShow, NotificationType.WARNING, project, externalSystemId, new NotificationListener() { + @Override + public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { + if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) { + return; + } + ShowSettingsUtil.getInstance().editConfigurable(project, configurable); + } + }); } }); } |