From 465f40702362c7ea54e6b05ba12b419597b966c0 Mon Sep 17 00:00:00 2001 From: bluelhf Date: Sat, 15 Apr 2023 01:01:48 +0300 Subject: [PATCH] fix(application-service): use postStartupActivity instead of internal preloadingActivity --- .../activity/AppPreloadingActivity.kt | 12 ------------ .../activity/AppStartupActivity.kt | 18 ++++++++++++++++++ src/main/resources/META-INF/plugin.xml | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) delete mode 100644 src/main/kotlin/fi/testaustime/plugin_intellij/activity/AppPreloadingActivity.kt create mode 100644 src/main/kotlin/fi/testaustime/plugin_intellij/activity/AppStartupActivity.kt diff --git a/src/main/kotlin/fi/testaustime/plugin_intellij/activity/AppPreloadingActivity.kt b/src/main/kotlin/fi/testaustime/plugin_intellij/activity/AppPreloadingActivity.kt deleted file mode 100644 index c7e3333..0000000 --- a/src/main/kotlin/fi/testaustime/plugin_intellij/activity/AppPreloadingActivity.kt +++ /dev/null @@ -1,12 +0,0 @@ -package fi.testaustime.plugin_intellij.activity - -import com.intellij.openapi.application.PreloadingActivity -import com.intellij.openapi.components.service -import com.intellij.openapi.progress.ProgressIndicator -import fi.testaustime.plugin_intellij.services.TestaustimeApplicationService - -internal class AppPreloadingActivity : PreloadingActivity() { - override fun preload(indicator: ProgressIndicator) { - service() - } -} \ No newline at end of file diff --git a/src/main/kotlin/fi/testaustime/plugin_intellij/activity/AppStartupActivity.kt b/src/main/kotlin/fi/testaustime/plugin_intellij/activity/AppStartupActivity.kt new file mode 100644 index 0000000..29a3de0 --- /dev/null +++ b/src/main/kotlin/fi/testaustime/plugin_intellij/activity/AppStartupActivity.kt @@ -0,0 +1,18 @@ +package fi.testaustime.plugin_intellij.activity + +import com.intellij.openapi.components.service +import com.intellij.openapi.project.Project +import com.intellij.openapi.startup.StartupActivity +import fi.testaustime.plugin_intellij.services.TestaustimeApplicationService +import java.util.concurrent.atomic.AtomicBoolean + +internal class AppStartupActivity : StartupActivity.DumbAware { + + private var initialized: AtomicBoolean = AtomicBoolean(false); + + override fun runActivity(project: Project) { + if (initialized.compareAndSet(false, true)) { + service() + } + } +} \ No newline at end of file diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 0b5bc78..32bf137 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -22,7 +22,7 @@ Show the world how dedicated you are to your projects, now available for Intelli - +