Environment to prepare
- IDEA: 2020.3
- The JDK: 15
- The IDEA of community edition
- The commercial version also needs to be activated at startup, which can be a hassle. So you need to install an additional community version for debugging.
The SDK.
- The new SDK
- Open the file – > Project Structure – > SDKs
- Click the + sign to Add IntelliJ Platform Plugin SDK
- Select the installation location of the IDEA community version
Hello world in ten thousand
- demand
- Add a button in the Tools menu. Click on the lower right corner to pop up the prompt of Hello Idea.
- Create a project
- Create InjelliJ Platform Plugin
- Modify the information
- Create an action
- Write the code
package com.yuanshuai.tool.idea; import com.intellij.notification.*; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; public class HelloAction extends AnAction { @Override public void actionPerformed(AnActionEvent e) { NotificationGroup notificationGroup = new NotificationGroup("hello", NotificationDisplayType.BALLOON, true); Notification notification = notificationGroup.createNotification("hello", NotificationType.ERROR); Notifications.Bus.notify(notification); }}Copy the code
- Run the test