Personal blog
www.milovetingting.cn
Simple process of IntelliJ IDEA plug-in development
preface
When we’re working on a project with Android Studio, we’re all exposed to plug-ins that can help us be more productive. If we have specific requirements that we don’t yet have a plug-in to meet, we can do this by customizing the plug-in.
Custom plug-in
Create plug-in project
File-New-Project
On the create project screen, selectIntelliJ Platform Plugin
, select on the rightSDK
There is a choice hereIntelliJ IDEA
The SDK in the installation directory contains the JARS required for later plug-in development.
- Click on the
Next
In the dialog box that is displayed, configure the project information, including the project name and save the project address.
Configure the SDK
If the SDK for IntelliJ IDEA was not available when the project was created earlier, you can configure it here
- File-Project Structure-Platform Settings-SDKs.
- If there are no optional SDKS on the right, you need to configure them first
JDK
. point+
No. –Add JDK
- Select the location of the JDK
- After adding the JDK
- Add IntelliJ IDEA SDK
- Select the installation location of IntelliJ IDEA
- And I’m gonna go ahead and select JDK
- After configuration.
- Click Project settings-project and select the SDK just configured from the Project SDK on the right
Configuring Plug-in Information
Configure the plug-in ID, plug-in name, plug-in description, and update log.
Create an Action
- In the SRC directory, right-click -new-plugin devkit-action
- Set the ID and name of the action. In the Groups panel, select the group to which the action is to be added
- Once created, the actual logic is implemented in the Action’s callback method. Here, as a demonstration, only one dialog box pops up.
Release the plugin
- Build-Prepare Plugin Module
- When Build is complete, the plug-in package is generated
Application of plug-in
- File-setting-plugins, select install from Disk
- In the window that pops up, select the plug-in package you just generated, and when you are sure, restart the IDE
- Since the previous plugin was in the Generate group, we could right-click the file editing screen -Generate or press Alt+Insert
- On the screen that pops up, select the first item, and this is the plug-in we defined
- We can skip steps 3 and 4 and invoke the plug-in directly from the shortcut keys defined earlier
Afterword.
This article describes the simplest process for developing a plug-in based on IntelliJ IDEA. Of course, the actual plug-in development, is much more complex than this, involving more API, specific use can refer to the official documentation.