From e7a323fc929abe34379b3a654943f7b772f8f1b1 Mon Sep 17 00:00:00 2001 From: Luo Tim Date: Thu, 10 Oct 2024 00:03:06 +0800 Subject: [PATCH] Remove ProjectActivity to fix compatibility problem --- .../kotlin/ai/devchat/plugin/DevChatToolWindowFactory.kt | 3 +++ src/main/kotlin/ai/devchat/storage/RecentFilesTracker.kt | 8 -------- src/main/resources/META-INF/plugin.xml | 1 - 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/ai/devchat/plugin/DevChatToolWindowFactory.kt b/src/main/kotlin/ai/devchat/plugin/DevChatToolWindowFactory.kt index d904241..3011e9f 100644 --- a/src/main/kotlin/ai/devchat/plugin/DevChatToolWindowFactory.kt +++ b/src/main/kotlin/ai/devchat/plugin/DevChatToolWindowFactory.kt @@ -5,8 +5,10 @@ import ai.devchat.core.DevChatClient import ai.devchat.core.DevChatWrapper import ai.devchat.installer.DevChatSetupThread import ai.devchat.storage.ActiveConversation +import ai.devchat.storage.RecentFilesTracker import com.intellij.openapi.Disposable import com.intellij.openapi.components.Service +import com.intellij.openapi.components.service import com.intellij.openapi.project.DumbAware import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer @@ -35,6 +37,7 @@ class DevChatService(project: Project) { class DevChatToolWindowFactory : ToolWindowFactory, DumbAware, Disposable { override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) { + project.service() val devChatService = project.getService(DevChatService::class.java) val browser = Browser(project) devChatService.browser = browser diff --git a/src/main/kotlin/ai/devchat/storage/RecentFilesTracker.kt b/src/main/kotlin/ai/devchat/storage/RecentFilesTracker.kt index 5417c61..12010aa 100644 --- a/src/main/kotlin/ai/devchat/storage/RecentFilesTracker.kt +++ b/src/main/kotlin/ai/devchat/storage/RecentFilesTracker.kt @@ -3,12 +3,10 @@ package ai.devchat.storage import ai.devchat.common.Log import com.intellij.openapi.application.runInEdt import com.intellij.openapi.components.Service -import com.intellij.openapi.components.service import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileEditor.FileEditorManagerListener import com.intellij.openapi.project.Project import com.intellij.openapi.roots.ProjectFileIndex -import com.intellij.openapi.startup.ProjectActivity import com.intellij.openapi.vfs.VirtualFile import com.intellij.util.messages.MessageBusConnection @@ -49,9 +47,3 @@ class RecentFilesTracker(private val project: Project) { return recentFiles.toList() } } - -class RecentFilesStartupActivity : ProjectActivity { - override suspend fun execute(project: Project) { - project.service() - } -} diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 2954512..7bcf066 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -36,7 +36,6 @@ -