Java diff viewer Component?

R

Rogan Dawes

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.
 
J

Jeffrey Schwab

Rogan said:
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.
 
R

Rogan Dawes

Jeffrey said:
Rogan said:
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
 
R

Rogan Dawes

Rogan said:
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=da...81edaf745ea1f3a963;f=src/org/incava/util/diff>
and
(for the DiffPanel sources)
<http://dawes.za.net/gitweb.cgi?p=da...745ea1f3a963;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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top