Implement global notification for configurations update of gradle scripts

For 193: it will be a simple notification at the bottom of the IDEA window
For 201: a floating notification in the editor is implemented near "Load Gradle Changes" icon
^KT-34443 Fixed
This commit is contained in:
Natalia Selezneva
2020-03-18 10:47:56 +03:00
parent e300b30de1
commit a35523b6d0
11 changed files with 213 additions and 12 deletions
@@ -58,9 +58,8 @@ class DefaultScriptConfigurationNotificationFactory : ScriptConfigurationNotific
withSelectedEditor(project) { manager ->
val existingPanel = notificationPanel
if (existingPanel != null) {
notificationPanel?.let {
manager.removeTopComponent(this, it)
}
existingPanel.onClick = onClick
return@withSelectedEditor
}
val panel = NewLoadConfigurationNotificationPanel(onClick, project)
@@ -84,7 +83,7 @@ class DefaultScriptConfigurationNotificationFactory : ScriptConfigurationNotific
by UserDataProperty<FileEditor, NewLoadConfigurationNotificationPanel>(Key.create("load.script.configuration.panel"))
private class NewLoadConfigurationNotificationPanel(
val onClick: () -> Unit,
var onClick: () -> Unit,
project: Project
) : EditorNotificationPanel() {
@@ -191,17 +191,16 @@ internal class DefaultScriptConfigurationManager(project: Project) :
if (postponeLoading) {
ScriptConfigurationNotificationFactory.NOTIFICATION_FACTORY.getPoint(project).extensionList.firstOrNull {
it.showNotification(virtualFile, project) {
runAsyncLoaders(file, virtualFile, scriptDefinition, async, postponeLoading)
runAsyncLoaders(file, virtualFile, scriptDefinition, async, isLoadingPostponed = true)
}
}
} else {
runAsyncLoaders(file, virtualFile, scriptDefinition, async, postponeLoading)
runAsyncLoaders(file, virtualFile, scriptDefinition, async, isLoadingPostponed = false)
}
}
}
}
// в нотификации остается старый колбек - нужно перезаписывать колбек
private fun runAsyncLoaders(
file: KtFile,
virtualFile: VirtualFile,