Skip to content

Commit

Permalink
Remove ProjectActivity to fix compatibility problem
Browse files Browse the repository at this point in the history
  • Loading branch information
pplam committed Oct 9, 2024
1 parent 352b459 commit e7a323f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/main/kotlin/ai/devchat/plugin/DevChatToolWindowFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -35,6 +37,7 @@ class DevChatService(project: Project) {

class DevChatToolWindowFactory : ToolWindowFactory, DumbAware, Disposable {
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
project.service<RecentFilesTracker>()
val devChatService = project.getService(DevChatService::class.java)
val browser = Browser(project)
devChatService.browser = browser
Expand Down
8 changes: 0 additions & 8 deletions src/main/kotlin/ai/devchat/storage/RecentFilesTracker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -49,9 +47,3 @@ class RecentFilesTracker(private val project: Project) {
return recentFiles.toList()
}
}

class RecentFilesStartupActivity : ProjectActivity {
override suspend fun execute(project: Project) {
project.service<RecentFilesTracker>()
}
}
1 change: 0 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<!-- <listener class="ai.devchat.plugin.IDELifecycleListener" topic="com.intellij.ide.AppLifecycleListener" />-->
<!-- </applicationListeners>-->
<extensions defaultExtensionNs="com.intellij">
<postStartupActivity implementation="ai.devchat.storage.RecentFilesStartupActivity"/>
<toolWindow id="${ASSISTANT_NAME_ZH}" secondary="false" icon="/icons/toolWindowIcon.svg" anchor="right"
factoryClass="ai.devchat.plugin.DevChatToolWindowFactory"/>
<applicationService serviceImplementation="ai.devchat.storage.DevChatSettingsState"/>
Expand Down

0 comments on commit e7a323f

Please sign in to comment.