DZone Forums
Go Back   DZone Forums > Community > Tools & IDEs > Eclipse
Reload this Page How to show the comparision of two text files in eclipse using code.?
Notices
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Apr 2008
Default How to show the comparision of two text files in eclipse using code.? - 09-17-2009, 12:47 AM

Hi,

I would like to show the text comparision of two files in eclipse editor view.
How can do that using the eclipse java code.

Help me..
Reply With Quote
  (#2 (permalink)) Old
Member
 
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Aug 2009
Default 09-22-2009, 04:25 AM

You can use the CompareUI.compareEditor method.

Code:
 File left =...;
 File right = ...;
 final CompareConfiguration cc = new CompareConfiguration();
 cc.setLeftLabel(left.getName());
 cc.setRightLabel(right.getName);
 CompareUI.openCompareEditor(new FileCompareInput(cc, left,right));
where FileCompareInput is an implementation of the abstract class EditorCompareInput.

hope that helps,

Benoit.
Reply With Quote
  (#3 (permalink)) Old
Member
 
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Apr 2008
Default 10-12-2009, 01:49 PM

in the prepareInput method i am returning
-------------------
Differencer d = new Differencer();
Object diff = d.findDifferences(true, monitor, null, null, left, right);
return diff;
------------------

Where the left and right are the File objects.

But i am getting NullPointerException at CompareConfiguration cc = new CompareConfiguration();

What else i need to do ?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
eclipse autocomplete doesn't show all objectd emaayan Eclipse 3 03-11-2009 10:57 AM
Text merge using eclipse sdk kishore.abhishek Eclipse 0 12-08-2008 06:16 AM
NHibernate and EUSS Comparision ksh2dzone .NET 0 11-19-2008 06:54 AM
Editing .dox files with HTML code in Eclipse? dangerdg Eclipse 0 05-22-2008 11:48 AM
code to monitor new files in folder with file name in the arraylist: sahuabinash Java 0 04-04-2008 08:26 AM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com