4

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.

Community
  • 1
  • 1
Kylar
  • 8,876
  • 8
  • 41
  • 75

2 Answers2

5

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

Anton Arhipov
  • 6,479
  • 1
  • 35
  • 43
4

You can hook into 'flush changes to file system' processing via FileDocumentManagerListener registered at the FILE_DOCUMENT_SYNC topic.

You can get more information about IJ messaging here.

denis.zhdanov
  • 3,734
  • 20
  • 25
  • This looks promising. I guess you can't get much more authoritative than one of Idea's authors :) – Kylar Jul 19 '12 at 15:49