@@ -5,6 +5,7 @@ import com.intellij.ide.plugins.InstalledPluginsState
5
5
import com.intellij.openapi.application.invokeLater
6
6
import com.intellij.openapi.diagnostic.Logger
7
7
import com.intellij.openapi.diagnostic.logger
8
+ import com.intellij.openapi.extensions.PluginId
8
9
import com.intellij.openapi.fileTypes.ex.FileTypeChooser
9
10
import com.intellij.openapi.fileTypes.impl.AbstractFileType
10
11
import com.intellij.openapi.options.ShowSettingsUtil
@@ -67,26 +68,36 @@ class AdmStormStartupActivity : ProjectActivity {
67
68
Logger .setFactory(AdmStormLoggerFactory (sentry, defaultLoggerFactory))
68
69
}
69
70
71
+ private fun hasNewVersion (pluginId : PluginId ): Boolean {
72
+ return InstalledPluginsState .getInstance().hasNewerVersion(pluginId)
73
+ }
74
+
70
75
private fun checkUpdates (project : Project ) {
71
- val hasNewerVersion = InstalledPluginsState .getInstance().hasNewerVersion(AdmService .PLUGIN_ID )
72
- if (! hasNewerVersion) {
76
+ val hasAdmNewerVersion = hasNewVersion(AdmService .ADM_PLUGIN_ID )
77
+ val hasKphpStormNewVersion = hasNewVersion(AdmService .KPHPSTORM_PLUGIN_ID )
78
+ val hasModuliteNewVersion = hasNewVersion(AdmService .MODULITE_PLUGIN_ID )
79
+
80
+ if (! (hasAdmNewerVersion && hasModuliteNewVersion && hasKphpStormNewVersion)) {
73
81
return
74
82
}
75
83
76
- AdmNotification (" New version of the plugin is available" )
84
+ var updateNotification = AdmNotification (" New version of the plugin is available" )
77
85
.withActions(
78
86
AdmNotification .Action (" Update" ) { _, _ ->
79
87
invokeLater {
80
88
ShowSettingsUtil .getInstance().showSettingsDialog(project, " Plugins" )
81
89
}
82
90
}
83
91
)
84
- .withActions(
92
+
93
+ if (hasAdmNewerVersion) {
94
+ updateNotification = updateNotification.withActions(
85
95
AdmNotification .Action (" What's new" ) { _, _ ->
86
96
val url = " https://vkcom.github.io/admstorm/whatsnew.html?server_name=${ServerNameProvider .name()} "
87
97
BrowserUtil .browse(url)
88
98
}
89
99
)
90
- .show(project)
100
+ }
101
+ updateNotification.show(project)
91
102
}
92
103
}
0 commit comments