mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fileNameChangedEvent: do not notify BuildManager if file name has not actually changed;
ensure deleted-changed notification sequence (relevant for case-insensitive file systems)
This commit is contained in:
+11
-2
@@ -149,8 +149,12 @@ public class TranslatingCompilerFilesMonitor implements BulkFileListener {
|
||||
|
||||
checkIntersection(filesChanged, filesDeleted);
|
||||
|
||||
notifyFilesChanged(filesChanged);
|
||||
// If a file name differs ony in case, on case-insensitive file systems such name denotes still the same file.
|
||||
// In this situation filesDeleted and filesChanged sets will contain paths differing only in case.
|
||||
// Thus the order in which BuildManager is notified, is important:
|
||||
// first deleted paths notification and only then changed paths notification
|
||||
notifyFilesDeleted(filesDeleted);
|
||||
notifyFilesChanged(filesChanged);
|
||||
}
|
||||
|
||||
// todo: temporary check to verify events correctess
|
||||
@@ -194,11 +198,16 @@ public class TranslatingCompilerFilesMonitor implements BulkFileListener {
|
||||
@NotNull Collection<? super File> filesDeleted,
|
||||
@NotNull Collection<? super File> filesChanged) {
|
||||
if (VirtualFile.PROP_NAME.equals(event.getPropertyName())) {
|
||||
final String oldName = (String)event.getOldValue();
|
||||
final String newName = (String)event.getNewValue();
|
||||
if (Comparing.equal(oldName, newName)) {
|
||||
// Old and new names may actually be the same: sometimes such events are sent by VFS
|
||||
return;
|
||||
}
|
||||
final VirtualFile eventFile = event.getFile();
|
||||
if (isInContentOfOpenedProject(eventFile)) {
|
||||
final VirtualFile parent = eventFile.getParent();
|
||||
if (parent != null) {
|
||||
final String oldName = (String)event.getOldValue();
|
||||
final String root = parent.getPath() + "/" + oldName;
|
||||
if (eventFile.isDirectory()) {
|
||||
VfsUtilCore.visitChildrenRecursively(eventFile, new VirtualFileVisitor() {
|
||||
|
||||
Reference in New Issue
Block a user