When Show Diff is called on a file from a commit, the DiffTool is
shown only once, therefore any data (VirtualFile) requested at this
time, and any modifications to the tool (addComment, addGutter)
will be lost when user moves to the next or previous file
in the diff chain.
To customize the diff panel for each Change, we need to extend the
DiffPanel. Override the new protected method from the FrameDiffTool:
create a DiffPanelImpl extension that adds comment icons to the
gutter and adds an action to create a new comment.
By moving addCommentAction & addGutter to the DiffPanelImpl
extension, we can no more override the show() method which has some
complex logic partly copy-pasted here.
Get the VirtualFile not from the DataContext (it would return the
VF selected by user before calling Show Diff), but from the diff chain.
In addCommentAction get the filepath from the virtual file,
not from the revision (because the revision only for the first file
in the chain is passed there).
When Show Diff is called on a file from a commit, the DiffTool is shown only once, therefore any data (VirtualFile) requested at this time, and any modifications to the tool (addComment, addGutter) will be lost when user moves to the next or previous file in the diff chain.