Density-dependent pairing in nuclei far from stability