Reputation: 41087
I have an eclipse which generates java code. So if a method is there and is regenerated I want to show the old method and the newly generated one so the user can see the difference. Is this possible?
Upvotes: 0
Views: 1278
Reputation: 4833
I'm using Eclipse Kepler, so depending on your version your mileage may vary.
To compare a method with a previously generated version, do the following:
You'll get a diff window similar to if you were comparing two files.
Upvotes: 1
Reputation: 963
If your code generator is the one used by default by EMF, you can copy the generated method, and remove the @generated tag to the original one, then simply suffix the copied generated method with Gen and keep the @generated tag. For instance :
/* original code */
public String getName() {
...
}
@generated
public String getNameGen() {
...
}
At the next generation only getNameGen will me modified and you will be able to compare.
If you are looking to a more general solution to know if the regeneration modified some files, the best way is probably to store you files on a repo (with SVN or Git). After a regeneration filez not in sync will be indicated with graphical decorators and you will be able to use the compare editor to see the differences for each of them.
Upvotes: 1