Skip to content

Rich diff for group changes (diffs) #11221

@koppor

Description

@koppor

When a library is modified externally, the group diff is very small.

To reproduce:

  1. Create a new library with a few groups and assign some entries to them
  2. Outside of JabRef, open the bib file in a text editor, scroll down to the end of JabRef and modify the group structure, e.g., change the group name or add new group by copy and paste
  3. Wait for the dialog "This library has been modified by another program"
  4. Click on Review Changes
  5. See the metadata like in the screenshot

image

The line "Modified groups tree" is generated from the object org.jabref.logic.bibtex.comparator.GroupDiff. This class should be refined to show a "real" diff (which is then somehow passed via org.jabref.gui.collab.DatabaseChange#setChangeName inside GroupDiff).

The second block with Optional is originating by simply outputting the list of differences and each old and new object with toString(). Since the group diff is handled explicitly (by org.jabref.logic.bibtex.comparator.MetaDataDiff#getGroupDifferences) and implicilty by the list org.jabref.logic.bibtex.comparator.MetaDataDiff#getDifferences it currently appears twice. (org.jabref.gui.collab.DatabaseChangeList#compareAndGetChanges)

The groupDiff should be removed from MetaDataDiff and handled in org.jabref.gui.collab.DatabaseChangesResolverDialog.

  • The dialog should split up the changes in the meta data to separate lines to resolve
  • The button "Merge" should be clickable and a UI appear

Ideas:

  1. Simple text highlight of the diff. See org.jabref.gui.mergeentries.DiffHighlighting for ideas
  2. Create a real diff for groups (enhanced GroupDiff) and a UI to handle that
  3. Convert group structure to JSON, offer RichTextEditor for JSON. Convert JSON back to group structure. Use web technologies to handle the JSON and the diff. Embed the html page inside a WebView used. (Use some JavaScript library to handle JSON diffs.)

Metadata

Metadata

No fields configured for feature.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions