Set<String> preselectionCandidates = new LinkedHashSet<String>();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
// iterate through all the files that may be committed
for (String fileName : files) {
URI uri = new File(repo.getWorkTree(), fileName).toURI();
IFile[] workspaceFiles = root.findFilesForLocationURI(uri);
if (workspaceFiles.length > 0) {
IFile file = workspaceFiles[0];
for (IResource resource : selectedResources) {
// if any selected resource contains the file, add it as a
// preselection candidate