StopCoding: An IntelliJ IDEA Plugin to Prevent Coding Fatigue – Installation, Usage, and Development Guide
This article introduces StopCoding, an IntelliJ IDEA plugin designed to interrupt prolonged coding sessions by showing an unclosable reminder dialog, and provides step‑by‑step installation, usage instructions, and a detailed Java‑based development tutorial including Swing UI and Timer implementation.
Preface
The author, motivated by personal health concerns caused by long coding sessions, decided to create an IntelliJ IDEA plugin named StopCoding that periodically shows a non‑dismissable reminder dialog with a countdown, forcing the user to take a break.
Installation and Usage Tutorial
Installation
Search for "StopCoding" in the IDEA plugin marketplace and install it (the plugin has passed official review).
For internal network users, download the plugin package from the provided link and install it locally.
Usage
Step 1: Open Tools → StopCoding from the menu bar.
Step 2: Configure the desired interval and other parameters, then save.
Step 3: Continue coding; when the interval elapses, an unclosable dialog appears with a rest countdown that only disappears after the break is completed.
Development Tutorial
The plugin is built with basic Java knowledge, using Swing for UI and java.util.Timer for scheduling.
Technical Scope
Plugin project structure
Swing for two dialog interactions
Timer as the core scheduling component
Plugin Project Structure
Key files and directories include:
plugin.xml : core configuration file.
data : contains SettingData (configuration model) and DataCenter (static runtime data).
service : includes TimerService (core timer logic).
task : defines RestTask (break timer) and WorkTask (work timer).
ui : holds UI components such as SettingDialog (settings dialog) and TipsDialog (break reminder dialog).
StopCodingSettingAction : entry point action that launches the plugin.
Swing
Creating Swing dialogs in IDEA is straightforward thanks to visual designers; the article outlines the three‑step process of building a dialog and adding events.
Creating the Dialog
Step 1 – design the dialog layout; Step 2 – configure component properties; Step 3 – finalize the dialog.
Adding Event Listeners
The generated dialog already includes OK and Cancel buttons with listeners. Custom listeners can be added to any component. Example code:
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 Scheduler
The plugin uses the standard JDK Timer to schedule work and rest intervals. Common APIs such as constructor, schedule , and cancel are demonstrated with screenshots.
Conclusion
With the provided overview, readers can explore the source code (https://github.com/jogeen/StopCoding) and build their own productivity‑enhancing IDEA plugins. The author hopes the plugin helps programmers maintain healthier work habits.
Architect's Tech Stack
Java backend, microservices, distributed systems, containerized programming, and more.
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.