StopCoding IntelliJ IDEA Plugin: Installation, Usage, and Development Guide
StopCoding is an IntelliJ IDEA plugin designed to prevent coding fatigue by periodically displaying an unclosable reminder dialog with a countdown, and this guide explains how to install, configure, and develop the plugin using Java, Swing UI components, and the JDK Timer API.
StopCoding Plugin Overview
StopCoding is a lightweight IntelliJ IDEA plugin created to help developers avoid prolonged coding sessions. It periodically shows a modal reminder dialog that cannot be dismissed until the countdown finishes, encouraging the user to take a break.
Installation Guide
1. Open IntelliJ IDEA, search for "StopCoding" in the plugin marketplace and install it (the plugin has passed official review).
2. For developers behind a corporate firewall, download the plugin manually from the release page and install it locally:
https://github.com/jogeen/StopCoding/releases/tag/20210104-V1.0
Local installation steps are shown below:
Usage Guide
Step 1: Open the plugin via Tools → StopCoding in the menu bar.
Step 2: Configure the reminder interval, break duration, and other parameters, then save.
Step 3: Continue coding. When the interval elapses, a modal dialog with a countdown appears; it cannot be closed until the break time is over, after which it disappears automatically.
Development Tutorial
The plugin is built with plain Java and Swing. The project structure is simple and consists of the following packages:
plugin.xml – core configuration file for the IntelliJ platform.
data – contains SettingData (model for configuration) and DataCenter (static runtime data).
service – includes TimerService , the core timer logic.
task – defines RestTask (break timer) and WorkTask (coding timer).
ui – holds SettingDialog (configuration UI) and TipsDialog (break reminder UI).
StopCodingSettingAction – entry point action that adds the menu item.
Swing UI
The UI is created using IntelliJ's visual designer, which allows drag‑and‑drop layout of components. Two dialogs are needed: one for settings and one for the break reminder.
Adding Event Listeners
Buttons in the dialogs already have default click listeners; custom listeners can be added as needed. Below is an example of a dialog class with OK and Cancel button listeners:
public class TestDialog extends JDialog {
private JPanel contentPane;
private JButton buttonOK;
private JButton buttonCancel;
public TestDialog() {
setContentPane(contentPane);
setModal(true);
getRootPane().setDefaultButton(buttonOK);
buttonOK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
onOK();
}
}); // OK button listener
buttonCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
onCancel();
}
}); // Cancel button listener
// other code
}
}Timer Implementation
The plugin relies on the JDK Timer class to schedule work and break periods. Typical usage involves creating a TimerTask , scheduling it with schedule() , and cancelling it with cancel() when the break ends.
Below are screenshots of the Timer API documentation used in the project:
With these components, developers can extend or customize the plugin to fit their own productivity needs.
Conclusion
This article introduced the motivation behind StopCoding, provided step‑by‑step installation and usage instructions, and detailed the internal architecture and key code snippets for developers who wish to build or modify the plugin.
Java Architect Essentials
Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.