If you replace this line with those:

IFile res = root.getFileForLocation(obj.getLocation());
if (res == null)
	res = root.getFile(obj.getLocation());
return res;

You will get an default icon for non-workspace files ;)