ktisha / Crucible4IDEA

Crucible plugin for IntelliJ IDEA
MIT License
59 stars 26 forks source link

#36 Fix adding and showing comments for the diff chain #37

Closed klikh closed 11 years ago

klikh commented 11 years ago

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.

  1. 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.
  2. 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.
  3. Get the VirtualFile not from the DataContext (it would return the VF selected by user before calling Show Diff), but from the diff chain.
  4. 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).