Reputation: 2257
I am writing an eclipse plugin that notices when a file has moved or been renamed. In eclipse, this can happen when you choose to move or rename a file. The interesting thing is that in a rename, for example, eclipse will delete the old file and create a brand new file.
I do have access to the old file and the new one:
//grab each new and deleted file
IFile oldFile = resourceParser.getDeletedFiles().get(i);
IFile newFile = resourceParser.getNewFiles().get(i);
The problem is that in some situations (renaming a package, for example) a file will be moved and the contents of the file will be changed to account for the new package name.
So, I need to get a list of differences between the two files. Like I said, I have access to the two IFiles (the deleted one and the new one) but I want to see how their contents differ. Is there some kind of java diff tool that will produce a simple list of changes that I can manipulate?
Upvotes: 0
Views: 89
Reputation: 111142
The Eclipse org.eclipse.compare
provides a general mechanism for writing diff tools and editors, this is described in the Eclipse Help.
The Java Development Tools part of Eclipse extends this compare support for Java, however the code is in the org.eclipse.jdt.ui.internal.ui.compare
package which is internal and consequently not part of the Eclipse API and should not be used Eclipse API Rules of Engagement
Upvotes: 1