Backend Development 21 min read

IntelliJ IDEA Plugin Development: Setup, Components, Actions, Services, Persistence, GUI

This article provides a comprehensive guide to developing IntelliJ IDEA plugins, covering environment configuration, project structure, component and service creation, action implementation, extension points, state persistence, GUI design, and packaging, with detailed code examples and screenshots.

JD Tech
JD Tech
JD Tech
IntelliJ IDEA Plugin Development: Setup, Components, Actions, Services, Persistence, GUI

The article introduces how to create IntelliJ IDEA plugins, starting with installing Android Studio/IntelliJ IDEA and setting up the development environment.

It explains the required project structure, showing a typical layout with src/ and resources/META-INF/plugin.xml directories.

Component development is covered, including defining application, project, and module components, registering them in plugin.xml , and their lifecycle methods ( initComponent , disposeComponent , projectOpened , etc.). Example registration: <application-components> <component> <interface-class>com.example.test.Component1</interface-class> <implementation-class>com.example.test.Component1Impl</implementation-class> </component> </application-components>

Action creation is demonstrated by extending AnAction and overriding actionPerformed . Sample code: public class TextBoxes extends AnAction { @Override public void actionPerformed(AnActionEvent e) { Project project = e.getData(PlatformDataKeys.PROJECT); Messages.showInputDialog(project, "What is your name?", "Input your name", Messages.getQuestionIcon()); } } The action is registered in plugin.xml : <actions> <group id="MyPlugin.SampleMenu" text="Sample Menu" description="Sample menu"> <add-to-group group-id="MainMenu" anchor="last"/> <action id="Myplugin.Textboxes" class="Mypackage.TextBoxes" text="Text Boxes" description="A test menu item"/> </group> </actions>

The guide also covers extension points and extensions, showing how to declare an <extensionPoint> and implement it with implementation or beanClass attributes.

Service development is explained, with examples of declaring an application or project service in plugin.xml and accessing it via ServiceManager.getService : MyProjectService service = ServiceManager.getService(MyProjectService.class);

State persistence is addressed using PropertiesComponent for simple key‑value data and PersistentStateComponent for complex state. Example of a persistent component: @State(name = "PersistentDemo", storages = {@Storage("PluginDemo.xml")}) public class PersistentDemo implements PersistentStateComponent { public static class State { public String value; } private State myState = new State(); @Override public State getState() { return myState; } @Override public void loadState(State state) { XmlSerializerUtil.copyBean(state, this); } }

GUI design using IntelliJ's GUI Designer is described: enable code generation, create a .form file, drag Swing components, assign field names, and generate Java source. The generated code contains methods wrapped with $ markers that are updated automatically when the form changes.

Finally, the article outlines how to package the plugin (JAR or ZIP), install it via the IDE’s plugin settings, and run/debug the plugin within a sandboxed IDEA instance.

JavaGUIPersistenceIntelliJ IDEAplugin developmentActionsServices
JD Tech
Written by

JD Tech

Official JD technology sharing platform. All the cutting‑edge JD tech, innovative insights, and open‑source solutions you’re looking for, all in one place.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.