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?
0

Hi,

Try using DynamicPluginListener.beforePluginUnload().

1

how would I call this function before the user uninstalls? where to add this in plugin.xml?

0

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

1

and how to implement a function that's called when a user disables the plugin instead of unloading it?

0

There is no open API for listening to the plugin disabling action.

0

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

0

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?

0

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?

0

See com.intellij.ide.AppLifecycleListener.appWillBeClosed().

0

请先登录再写评论。