Remove a file whenever plugin is removed
已回答
I have made a new file whenever user installs my plugin and want to remove it whenever user removes the plugin. How to implement it?
请先登录再写评论。
Hi,
Try using
DynamicPluginListener.beforePluginUnload()
.how would I call this function before the user uninstalls? where to add this in plugin.xml?
It should be registered as an application listener. It can be done programmatically or in plugin.xml. For more details, dee:
https://plugins.jetbrains.com/docs/intellij/plugin-listeners.html
and how to implement a function that's called when a user disables the plugin instead of unloading it?
There is no open API for listening to the plugin disabling action.
Okay, and how to implement a function that's called when the user closes the intellij idea so that I can delete a token in SecretService
Also, thank you!!
Sorry, but I don't get what API you mean. What is SecretService? Why do you need to delete a token? Isn't it stored in memory?
I want to delete something whenever user closes the IDE. I have written the code for deleting it, I just want the function to run whenever user closes the IDE. How to achieve that?
See
com.intellij.ide.AppLifecycleListener.appWillBeClosed()
.