-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use DynamicPluginListener to create and remove .copilot-plugin (#…
…299) * Use DynamicPluginListener to create and remove .copilot-plugin * spotless
- Loading branch information
1 parent
400c2c3
commit fc8dc9f
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/com/vaadin/plugin/copilot/listeners/CopilotDynamicPluginListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.vaadin.plugin.copilot.listeners | ||
|
||
import com.intellij.ide.plugins.DynamicPluginListener | ||
import com.intellij.ide.plugins.IdeaPluginDescriptor | ||
import com.intellij.openapi.diagnostic.Logger | ||
import com.intellij.openapi.project.Project | ||
import com.vaadin.plugin.copilot.CopilotPluginUtil | ||
|
||
class CopilotDynamicPluginListener(private val project: Project) : DynamicPluginListener { | ||
|
||
private val LOG: Logger = Logger.getInstance(CopilotDynamicPluginListener::class.java) | ||
|
||
override fun beforePluginUnload(pluginDescriptor: IdeaPluginDescriptor, isUpdate: Boolean) { | ||
CopilotPluginUtil.removeDotFile(project) | ||
LOG.debug("Plugin is going to be unloaded, .copilot-plugin removed") | ||
} | ||
|
||
override fun pluginLoaded(pluginDescriptor: IdeaPluginDescriptor) { | ||
CopilotPluginUtil.saveDotFile(project) | ||
LOG.debug("Plugin loaded, .copilot-plugin created") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters