How to implement InEditor Diff View Windsurf like via plugin

Hi Guys
I’m trying to implement Windsurf like In editor diff viewer which can accept and reject the code as seen in image.

Goal is to populate the code coming from agent and let user accept or reject the code inside editor as seen in the image.

Can you suggest how to implement this in java swing

I seem to have seen a similar implementation in the source code of continue. continue/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/VerticalDiffBlock.kt at main · continuedev/continue · GitHub