-
Notifications
You must be signed in to change notification settings - Fork 274
Adding update/restart action to notifications #5136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 32 commits
c3cc2bf
09729c7
885f3f0
f0aca38
e909a0e
5a84e39
56c1888
a981227
682897f
adb6ec7
dbfcefc
823ea7f
218c8ed
b684a01
368fd25
57fb2ef
a5126d1
22f9438
87ec1d9
24a2f65
78f8c6b
bfc1077
8a1dee4
1a83a40
9e8b0af
1b12854
e7d8594
bbf6779
a8fa482
218f254
2b359fa
4c32661
5c8f131
ae35e39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,33 @@ | |
|
|
||
| import com.intellij.icons.AllIcons | ||
| import com.intellij.ide.BrowserUtil | ||
| import com.intellij.ide.plugins.IdeaPluginDescriptor | ||
| import com.intellij.ide.plugins.PluginManagerCore | ||
|
||
| import com.intellij.notification.NotificationAction | ||
|
||
| import com.intellij.openapi.actionSystem.AnAction | ||
| import com.intellij.openapi.actionSystem.AnActionEvent | ||
| import com.intellij.openapi.application.ApplicationManager | ||
|
||
| import com.intellij.openapi.application.runInEdt | ||
| import com.intellij.openapi.options.ShowSettingsUtil | ||
|
||
| import com.intellij.openapi.progress.ProgressIndicator | ||
| import com.intellij.openapi.progress.ProgressManager | ||
| import com.intellij.openapi.progress.Task | ||
| import com.intellij.openapi.project.Project | ||
| import com.intellij.openapi.ui.Messages | ||
| import com.intellij.ui.EditorNotificationPanel | ||
| import com.intellij.util.concurrency.annotations.RequiresBackgroundThread | ||
|
||
| import software.aws.toolkits.core.utils.debug | ||
|
||
| import software.aws.toolkits.core.utils.error | ||
|
||
| import software.aws.toolkits.core.utils.getLogger | ||
|
||
| import software.aws.toolkits.jetbrains.AwsPlugin | ||
| import software.aws.toolkits.jetbrains.AwsToolkit | ||
| import software.aws.toolkits.jetbrains.core.plugin.PluginUpdateManager | ||
| import software.aws.toolkits.jetbrains.core.plugin.PluginUpdateManager.Companion.updatePlugin | ||
|
||
| import software.aws.toolkits.jetbrains.settings.AwsSettingsSharedConfigurable | ||
|
||
| import software.aws.toolkits.jetbrains.utils.notifyInfo | ||
|
||
| import software.aws.toolkits.resources.AwsCoreBundle | ||
| import software.aws.toolkits.telemetry.Component | ||
|
||
| import software.aws.toolkits.telemetry.ToolkitTelemetry | ||
|
Check warning on line 34 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/CustomizeNotificationsUi.kt
|
||
|
||
|
|
||
| fun checkSeverity(notificationSeverity: String): NotificationSeverity = when (notificationSeverity) { | ||
| "Critical" -> NotificationSeverity.CRITICAL | ||
|
|
@@ -37,7 +57,7 @@ | |
| if (action.type == "UpdateExtension") { | ||
| add( | ||
| NotificationActionList(AwsCoreBundle.message("notification.update")) { | ||
| // TODO: Add update logic | ||
| updatePlugins() | ||
| } | ||
| ) | ||
| } | ||
|
|
@@ -96,6 +116,21 @@ | |
|
|
||
| return panel | ||
| } | ||
| private fun updatePlugins() { | ||
| val pluginUpdateManager = PluginUpdateManager() | ||
| runInEdt { | ||
| ProgressManager.getInstance().run(object : Task.Backgroundable( | ||
| null, | ||
| AwsCoreBundle.message("aws.settings.auto_update.progress.message") | ||
| ) { | ||
| override fun run(indicator: ProgressIndicator) { | ||
| pluginUpdateManager.checkForUpdates(indicator, AwsPlugin.CORE) | ||
| pluginUpdateManager.checkForUpdates(indicator, AwsPlugin.TOOLKIT) | ||
| pluginUpdateManager.checkForUpdates(indicator, AwsPlugin.Q) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
Comment on lines
+105
to
+119
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i feel like this snippet exists in the auto updater |
||
| } | ||
|
|
||
| data class NotificationActionList( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.