From 3de811edb84615f20126701371bc50f4376fcc36 Mon Sep 17 00:00:00 2001 From: "denis_kusakin@epam.com" Date: Sun, 15 Aug 2021 16:01:35 +0300 Subject: [PATCH] #25 Plugin is incompatible with Idea v 2021.2 --- build.gradle | 4 ++-- .../aem/groovyconsoleplugin/console/EditorDecorator.kt | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index c2e8309..c057b98 100644 --- a/build.gradle +++ b/build.gradle @@ -36,10 +36,10 @@ compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } intellij { - version '2021.1' + version '2021.2' } patchPluginXml { changeNotes """ - Fix compatibility issue. Plugin is now available for IDEA 2021.1. + Fix compatibility issue. Plugin is now available for IDEA 2021.2. """ } \ No newline at end of file diff --git a/src/main/kotlin/org/deniskusakin/aem/groovyconsoleplugin/console/EditorDecorator.kt b/src/main/kotlin/org/deniskusakin/aem/groovyconsoleplugin/console/EditorDecorator.kt index ddeee33..a79b9ac 100644 --- a/src/main/kotlin/org/deniskusakin/aem/groovyconsoleplugin/console/EditorDecorator.kt +++ b/src/main/kotlin/org/deniskusakin/aem/groovyconsoleplugin/console/EditorDecorator.kt @@ -20,12 +20,13 @@ import org.deniskusakin.aem.groovyconsoleplugin.services.AemGroovyScriptsDetecti import org.deniskusakin.aem.groovyconsoleplugin.services.PersistentStateService import javax.swing.JComponent -class EditorDecorator(private val project: Project, private val notifications: EditorNotifications) : EditorNotifications.Provider() { +class EditorDecorator(private val project: Project) : EditorNotifications.Provider() { companion object { private val myKey = Key.create("aem.groovy.console.toolbar") } init { + val notifications = project.getService(EditorNotifications::class.java) project.messageBus.connect(project).subscribe(SettingsChangedNotifier.TOPIC, object : SettingsChangedNotifier { override fun settingsChanged() { notifications.updateAllNotifications() @@ -42,7 +43,8 @@ class EditorDecorator(private val project: Project, private val notifications: E val service = ServiceManager.getService(project, PersistentStateService::class.java) val serverFromFile = file.getUserData(AEMGroovyConsole.GROOVY_CONSOLE_CURRENT_SERVER) val availableServerNames = service.getAEMServers().map { it.name } - val currentServerName = (if (serverFromFile == null || availableServerNames.contains(serverFromFile)) serverFromFile else null) + val currentServerName = + (if (serverFromFile == null || availableServerNames.contains(serverFromFile)) serverFromFile else null) ?: availableServerNames.firstOrNull() file.putUserData(AEMGroovyConsole.GROOVY_CONSOLE_CURRENT_SERVER, currentServerName) if (currentServerName == null) {