IntelliJ Plugin - Needs to hook into existing actions

intellij-idea, intellij-plugin, java

Solution

Here's the code example of how to intercept 'on save' event by a custom plugin.

Problem

I'm writing a plugin to IntelliJ, and need to hook into some of the existing actions that already exist, like when a file is saved, the code is compiled, or a refactoring happens. I wasn't able to find any info on the plugin site about existing actions, only new actions. These posts are similar: Save actions in IntelliJ IDEA Intellij reformat on file save but since they don't include actually writing a plugin, I'm hoping there may be some internal hook for doing so.

Original source

Related problems