Java diff viewer Component?

Discussion in 'Java' started by Rogan Dawes, Nov 30, 2005.

  1. Rogan Dawes

    Rogan Dawes Guest

    Hi folks,

    I'm looking for a Swing Component that can display differences between
    two files/streams/char arrays side by side, preferably with colour
    highlighting.

    Remarkably, it seems that such a thing is hard to come by, along with
    Java implementations of various diff algorithms.

    Any ideas?

    For reference purposes, I have looked at implementing the Levenshtein
    distance algorithm, as well as investigated ports of the GNU diff algo
    to Java. These are both options, of course.

    However, I guess that the diff algorithm would probably be dictated by
    the diff viewer Component, so I'm not going too far in that direction yet.

    License should preferably be GPL compatible, if at all possible.

    Thanks for any suggestions.

    Rogan.

    P.S. The most obvious search result (JDiff) provides reports on the
    differences between versions of the Java API :-( Not quite what I was
    looking for.
    Rogan Dawes, Nov 30, 2005
    #1
    1. Advertising

  2. Rogan Dawes wrote:
    > Hi folks,
    >
    > I'm looking for a Swing Component that can display differences between
    > two files/streams/char arrays side by side, preferably with colour
    > highlighting.
    >
    > Remarkably, it seems that such a thing is hard to come by, along with
    > Java implementations of various diff algorithms.
    >
    > Any ideas?
    >
    > For reference purposes, I have looked at implementing the Levenshtein
    > distance algorithm, as well as investigated ports of the GNU diff algo
    > to Java. These are both options, of course.
    >
    > However, I guess that the diff algorithm would probably be dictated by
    > the diff viewer Component, so I'm not going too far in that direction yet.
    >
    > License should preferably be GPL compatible, if at all possible.
    >
    > Thanks for any suggestions.
    >
    > Rogan.
    >
    > P.S. The most obvious search result (JDiff) provides reports on the
    > differences between versions of the Java API :-( Not quite what I was
    > looking for.


    I've played with this before, but I didn't get to use it my own work
    because of its GPL:

    http://www.bmsi.com/java/#diff

    Send the output to the textual display component of your choice.
    Jeffrey Schwab, Nov 30, 2005
    #2
    1. Advertising

  3. Rogan Dawes

    Rogan Dawes Guest

    Jeffrey Schwab wrote:
    > Rogan Dawes wrote:
    >
    >> Hi folks,
    >>
    >> I'm looking for a Swing Component that can display differences between
    >> two files/streams/char arrays side by side, preferably with colour
    >> highlighting.
    >>
    >> Remarkably, it seems that such a thing is hard to come by, along with
    >> Java implementations of various diff algorithms.
    >>
    >> Any ideas?
    >>
    >> For reference purposes, I have looked at implementing the Levenshtein
    >> distance algorithm, as well as investigated ports of the GNU diff algo
    >> to Java. These are both options, of course.


    [snip]

    >
    > I've played with this before, but I didn't get to use it my own work
    > because of its GPL:
    >
    > http://www.bmsi.com/java/#diff
    >
    > Send the output to the textual display component of your choice.


    Thanks for the response. I had also encountered that version, which is,
    IIRC, a port of the gnu diff sources.

    Rogan
    Rogan Dawes, Dec 1, 2005
    #3
  4. Rogan Dawes

    Rogan Dawes Guest

    Rogan Dawes wrote:
    > Hi folks,
    >
    > I'm looking for a Swing Component that can display differences
    > between two files/streams/char arrays side by side, preferably with
    > colour highlighting.
    >
    > Remarkably, it seems that such a thing is hard to come by, along with
    > Java implementations of various diff algorithms.
    >
    > Any ideas?
    >
    > For reference purposes, I have looked at implementing the Levenshtein
    > distance algorithm, as well as investigated ports of the GNU diff
    > algo to Java. These are both options, of course.


    Well, I gave up, and implemented one myself, based on the incava.org
    Diff implementation.

    You can take a look at it at:

    (For the Diff sources)
    <http://dawes.za.net/gitweb.cgi?p=dawes.za.net/webscarab.git;a=tree;h=148dc26a7ff3ef6ff5ddc35b206d5f9f60a30489;hb=7fc5807cc8391a080d18d081edaf745ea1f3a963;f=src/org/incava/util/diff>
    and
    (for the DiffPanel sources)
    <http://dawes.za.net/gitweb.cgi?p=dawes.za.net/webscarab.git;a=tree;h=f6b756fbe78c6f1be21a00cffbee5e904a0efcd9;hb=7fc5807cc8391a080d18d081edaf745ea1f3a963;f=src/org/incava/util/diff/swing>

    It needs some tweaking to improve configurability (e.g. the colours for
    highlighting, etc), but it is reasonably usable as is.

    Feedback appreciated.

    Rogan
    Rogan Dawes, Dec 5, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cyril Vi?ville

    diff Process under diff users

    Cyril Vi?ville, Jun 29, 2004, in forum: Perl
    Replies:
    1
    Views:
    509
    Joe Smith
    Jun 29, 2004
  2. Berrucho
    Replies:
    2
    Views:
    635
    Infant Newbie
    Dec 5, 2003
  3. A Traveler

    Diff CSS styles for diff INPUT TYPE='s?

    A Traveler, Aug 31, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    4,922
    Steve Fulton
    Aug 31, 2004
  4. jacksgoogle
    Replies:
    0
    Views:
    1,748
    jacksgoogle
    May 11, 2005
  5. Austin Ziegler

    [ANN] Diff::LCS 1.1.0, Diff::LCS 1.0.4

    Austin Ziegler, Aug 8, 2004, in forum: Ruby
    Replies:
    3
    Views:
    187
    Austin Ziegler
    Aug 9, 2004
Loading...

Share This Page