From db20dcba3623b858baeb6efca1ead2b25b2d2ae9 Mon Sep 17 00:00:00 2001 From: Daniel Espendiller Date: Mon, 1 Apr 2024 10:47:48 +0200 Subject: [PATCH] migrate project startup service --- .../symfony2plugin/Symfony2ProjectComponent.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/Symfony2ProjectComponent.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/Symfony2ProjectComponent.java index cf001f562..e5e64abd4 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/Symfony2ProjectComponent.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/Symfony2ProjectComponent.java @@ -1,9 +1,11 @@ package fr.adrienbrault.idea.symfony2plugin; import com.intellij.openapi.Disposable; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.project.Project; +import com.intellij.openapi.startup.ProjectActivity; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.psi.PsiElement; import fr.adrienbrault.idea.symfony2plugin.dic.ContainerFile; @@ -14,6 +16,8 @@ import fr.adrienbrault.idea.symfony2plugin.util.IdeHelper; import fr.adrienbrault.idea.symfony2plugin.util.ProjectUtil; import fr.adrienbrault.idea.symfony2plugin.util.service.ServiceXmlParserFactory; +import kotlin.Unit; +import kotlin.coroutines.Continuation; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -25,11 +29,15 @@ * @author Adrien Brault */ public class Symfony2ProjectComponent { - public static class PostStartupActivity implements com.intellij.openapi.startup.StartupActivity { + public static class PostStartupActivity implements ProjectActivity { + @Nullable @Override - public void runActivity(@NotNull Project project) { - checkProject(project); + public Object execute(@NotNull Project project, @NotNull Continuation continuation) { + if (!ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManager.getApplication().isHeadlessEnvironment()) { + checkProject(project); + } + return Unit.INSTANCE; } }