I'm at Google working on an IJ plugin for google-java-format. It's the first source code formatter which our Java-style team has blessed as doing an acceptable job, and we're making an effort to refine it and push it into as many of our coding environments as possible.
I've experimented with three possible approaches, none of which feel ideal. Hoping I could get some advice here!
Implement a specialized CodeStyleManager which can delegate to our GJF library for Java files, or to the default CodeStyleManagerImpl for everything else.
This appears to be the approach I found in a couple projects on GitHub, but feels a little heavy-handed and possibly brittle.
Suppress IJ's Java formatting with a LanguageFormattingRestriction extension, register a PostFormatProcessor extension which performs formatting with GJF
This seems to be the cleanest solution, but the LanguageFormattingRestriction will cause the "Reformat code" menu item to be disabled in some situations, e.g. when the user highlights a Java file in the Project tree and wants to reformat it.
Suppress IJ's Java formatting with a no-op FormattingModelBuilder extension, register a PostFormatProcessor extension which performs formatting with GJF
There doesn't seem to be a straightforward way to implement a no-op FormattingModelBuilder or no-op FormattingModel.