Skip to content

Commit be875cd

Browse files
committed
Auto show devchat toolwindow after installed
1 parent 5e5473c commit be875cd

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package ai.devchat.idea
2+
3+
import com.intellij.ide.plugins.DynamicPluginListener
4+
import com.intellij.ide.plugins.IdeaPluginDescriptor
5+
import com.intellij.openapi.project.ProjectManager
6+
import com.intellij.openapi.wm.ToolWindowManager
7+
8+
class PluginInstallListener : DynamicPluginListener {
9+
override fun pluginLoaded(pluginDescriptor: IdeaPluginDescriptor) {
10+
if (pluginDescriptor.pluginId.idString == "ai.devchat.plugin") {
11+
val openProjects = ProjectManager.getInstance().openProjects
12+
if (openProjects.isNotEmpty()) {
13+
ToolWindowManager.getInstance(openProjects[0]).getToolWindow("DevChat")?.show()
14+
}
15+
}
16+
}
17+
}

src/main/resources/META-INF/plugin.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
id="org.intellij.sdk.settings.AppSettingsConfigurable"
3535
displayName="DevChat"/>
3636
<applicationService serviceImplementation="ai.devchat.idea.settings.DevChatSettingsState"/>
37+
<applicationListeners>
38+
<listener class="ai.devchat.idea.PluginInstallListener" topic="com.intellij.ide.plugins.DynamicPluginListener" />
39+
</applicationListeners>
3740
<notificationGroup id="Custom Notification Group"
3841
displayType="BALLOON"/>
3942
<notificationGroup id="stickyBalloon" displayType="STICKY_BALLOON" isLogByDefault="true"/>

0 commit comments

Comments
 (0)