Compare External Files in Eclipse
Join the DZone community and get the full member experience.Join For Free
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:
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
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 ‘:
(i’m using ctrl+shift+home above).
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):
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:
with this, i can now compare and merge my files and folders with the eclipse compare view:
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:
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 .
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.