I attempted to develop a plugin that requires a feature to compare the differences between two pieces of content. I utilized SimpleDiffRequest
and DiffRequestPanel
, and created the DiffRequestPanel
using a DialogWrapper
. However, I noticed that the created page opens in a new window, whereas I want it to appear in a tab,just like open a file. What should I do? I also tried using showDiff
directly, but it didn’t achieve the desired result either.
I’m opening it with this code snippet:
fun invokeDiff(diffRequest: ContentDiffRequest) {
DiffManager.getInstance().showDiff(project, diffRequest, DiffDialogHints.DEFAULT)
}
Not sure if it’s the right way but works for me.
Is it something that can be ‘forced’, or is the user setting honored everywhere?
I’d imagine that DiffManager
might honor the user’s settings, but I don’t have the code handy right now to check.
Hi! I’m very sorry for the late reply.
You can take a look at com.intellij.diff.editor.DiffEditorTabFilesManager
. The best usage example can be found in DiffManagerImpl
- intellij-community/platform/diff-impl/src/com/intellij/diff/DiffManagerImpl.java at master · JetBrains/intellij-community · GitHub