getScriptsRoot().setDefaultCharset(fEncoding, new NullProgressMonitor());
getScriptsRoot().accept(new IResourceVisitor() {
public boolean visit(IResource resource) throws CoreException {
if (resource instanceof IFile) {
IFile file = (IFile) resource;
String defaultEncoding = fDefaultCharsetsByExtension.get(file.getFileExtension().toLowerCase());
if (defaultEncoding != null) {
String resourceCharset = file.getCharset();
if (resourceCharset == null) {
resourceCharset = defaultEncoding;
}
if (!fEncoding.equals(resourceCharset)) {
// if design encoding differ from default encoding we define it explicit
file.setCharset(fEncoding, new NullProgressMonitor());
} else {
file.setCharset(null, new NullProgressMonitor());
}
}
}
return true;
}