Uninstall a plug-in when the plug-in is installed

Answered

Are there any ways to detect whether certain plug-ins are installed when the user installs the plug-ins, and uninstall them automatically

0
15 comments

Your plugin can check installed plugins (com.intellij.ide.plugins.PluginManagerCore#getPlugin) using StartupActivity (https://plugins.jetbrains.com/docs/intellij/plugin-components.html#project-open) and show notification (https://plugins.jetbrains.com/docs/intellij/notifications.html#top-level-notifications-balloons) suggesting uninstalling incompatible plugins.

0

Hello
I have to uninstall a certain plug-in while installing a new plug-in, instead of notifying the user to uninstall, because my plug-in is divided into basic and advanced versions. When the user installs the basic version and then installs the advanced version , If you don’t uninstall the basic version when you install the advanced version, there will be a registration component error, or an error with the same key

0

If you control both plugins, you can use com.intellij.ide.plugins.PluginReplacement extension point. But it will not enforce disabling plugin.

0

id=com.zoulejiu.mybatis.smart.plugin This is the ID of the base version
id=com.mybatis.smart.pro.plugin is the ID of the premium version
The premium version contains the code of the basic version

0

Is there a way to delete a file after the idea is closed

0

You can add listener implementing com.intellij.ide.AppLifecycleListener

0

I added this, but when I went to delete the file, an error was reported saying that the file was occupied

0

What is "the file"? It could be the IDE or OS or some antivirus etc. etc. that keeps lock on file.

 

0

The file is the folder of the basic version of my plugin

0

2022-01-06 15:20:19,102 [2259381] INFO - is.listener.CheckMybatisPlugin - del file path:C:\Users\zoulejiu\AppData\Local\JetBrains\Toolbox\apps\IDEA-C\ch-0\213.6461.79.plugins\Mybatis Smart Code Helpis errorjava.nio.file.AccessDeniedException: C:\Users\zoulejiu\AppData\Local\JetBrains\Toolbox\apps\IDEA-C\ch-0\213.6461.79.plugins\Mybatis Smart Code Help\lib\activation-1.1.jar

0

I used this method NioFiles.deleteRecursively(Path.of(pluginPath)) to delete

0

You should not touch any files in the IDE own configuration/settings directories manually.

0

I saw that PluginManagerCore has methods to disable plugins and enable plugins, but I couldn’t find a way to add plugins, so I wanted to delete the plugin folder manually

0

Please use the two approaches suggested earlier (PluginReplacement, paid/free mixed version of plugin) and don't try to manually install/uninstall plugins via code.

0

Please sign in to leave a comment.