Compare External Files in Eclipse

eclipse is very workspace centric: it only knows and deals with files in the workspace. so it is easy to compare and merge files present in the workspace: i select both files/folders and compare them with each other:

compare with each other

compare with each other

but what if the files and folders are not in the workspace?

hidden option to compare external files

as outlined in this post , it needs a special plugin to search for files outside the eclipse workspace. and doing a file or folder compare outside of the workspace requires a trick as shown in this post .

thanks to a tip from john there is another (hidden) way in eclipse to compare external files :-)

keyboard shortcut

the trick is described in this article and requires a keyboard shortcut assigned.

select the menu window > preferences > general > keys and assign a shortcut key for ‘ compare with other resource ‘:

compare with other resource key binding

compare with other resource key binding

(i’m using ctrl+shift+home above).

comparing

to compare, i have first to select a file, folder or project, then i press my shortcut. then the following dialog shows up (with the selection as default):

select resource to compare

select resource to compare

:idea: if the dialog does not show up, then i probably have not selected a file or folder in the eclipse project view.

now i can select the external files or folders to compare with:

selected external files

selected external files

with this, i can now compare and merge my files and folders with the eclipse compare view:

compare view in eclipse

compare view in eclipse

:idea: i can select two files/folders and then press the shortcut, and it will populate the search dialog values.

drag & drop

that compare dialog has a nice feature: i can drag&drop files and folders too:

c:\programdata\processor expert\cwmcu_pe5_00\examples\frdm-kl25z\frdm-kl25z_rnet\sources

c:\programdata\processor expert\cwmcu_pe5_00\examples\frdm-kl25z\frdm-kl25z_rnet\sources

summary

with ‘ compare with other resource ‘ i have a way to compare files/folders, and i’m not limited to the workspace files. the only disadvantage is that i need to assign a shortcut for it first. beside of that: yet another hidden treasure in eclipse :mrgreen: .

happy comparing :-)

 

 

 

 

Top