Computing some basic stats from a `SimpleDiffRequest`

I populate the SimpleDiffRequest using DiffContentFactory#createFragment (which returns a DocumentContent for each versions of a given code snippet to compare).

Is there some Util class that allows me to extract the following information:

  1. How many LOCs are displayed?
  2. How many chunks of code are highlighted?

For example, given this:

I’m looking for some util that would return (to my previous questions):

  1. six LOCs
  2. one chunk

The strategy can be following:

  1. Register DiffExtension and keep track of viewers (and please be careful with their lifetime and do cleanup on their disposal).
  2. Having diff viewer, you can access editor and diff model. E.g, for UnifiedDiffViewer you can get LOC from getEditor().getDocument().getLineCount() and number of chunks can be calculated from getDiffChanges().
  3. Diff content can be changed, so you have to install DiffViewerListener in your extension reacting on re-diff.