if (oldFile.exists() && oldFile.isAccessible()) { // if there's a file in the same folder
oldFile.refreshLocal(SAVE_IF_DIRTY, paramIProgressMonitor);
oldFile.move(newPath, true, true, paramIProgressMonitor);
}
FileSearcher fs = new FileSearcher(sourceType.getJavaProject().getProject(), sourceType.getTypeQualifiedName() + "*");
ResourcesPlugin.getWorkspace().getRoot().accept(fs);
List<IFile> ffs = fs.getFoundFiles();
for (IFile ff : ffs) {
if (ff != null && ff.exists() && ff.isAccessible() && FileSearcher.haveSameRelativePathToParentSourceFolder(ff, oldFile)) {
IPath nfn = ff.getFullPath().removeLastSegments(1).append(getArguments().getNewName());
if (ff.getName().startsWith(sourceType.getTypeQualifiedName() + "_")) { // variation
nfn = ff.getFullPath().removeLastSegments(1).append(getArguments().getNewName() + ff.getName().substring(ff.getName().indexOf("_")));
} else if (ff.getName().startsWith(sourceType.getTypeQualifiedName() + "$")) { // inner type
nfn = ff.getFullPath().removeLastSegments(1).append(getArguments().getNewName() + ff.getName().substring(ff.getName().indexOf("$")));
} else {
nfn = nfn.addFileExtension("html");
}
ff.refreshLocal(SAVE_IF_DIRTY, paramIProgressMonitor);
ff.move(nfn, true, true, paramIProgressMonitor);
}
}
fs = new FileSearcher(sourceType.getJavaProject().getProject(), sourceType.getTypeQualifiedName() + ".properties");
ResourcesPlugin.getWorkspace().getRoot().accept(fs);
ffs = fs.getFoundFiles();
for (IFile ff : ffs) {
if (ff != null && ff.exists() && ff.isAccessible() && FileSearcher.haveSameRelativePathToParentSourceFolder(ff, oldFile)) {
IPath nfn = ff.getFullPath().removeLastSegments(1).append(getArguments().getNewName());
if (ff.getName().startsWith(sourceType.getTypeQualifiedName() + "_")) { // variation