Local History fix: load file children on fileCreated event (second try)

This commit is contained in:
Anton Makeev
2014-03-06 16:49:13 +01:00
parent 5eab7d1f93
commit c66ea39019
3 changed files with 8 additions and 2 deletions
@@ -146,6 +146,13 @@ public class IdeaGateway {
return nf.getCachedChildren();
}
@NotNull
public static Collection<VirtualFile> loadAndIterateChildren(VirtualFile f) {
if (!(f instanceof NewVirtualFile)) return Collections.emptyList();
NewVirtualFile nf = (NewVirtualFile)f;
return Arrays.asList(nf.getChildren());
}
@NotNull
public RootEntry createTransientRootEntry() {
ApplicationManager.getApplication().assertReadAccessAllowed();
@@ -93,7 +93,7 @@ public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements V
myVcs.created(f.getPath(), f.isDirectory());
}
if (f.isDirectory()) {
for (VirtualFile each : IdeaGateway.iterateDBChildren(f)) {
for (VirtualFile each : IdeaGateway.loadAndIterateChildren(f)) {
createRecursively(each);
}
}
@@ -73,7 +73,6 @@ public class FileListeningTest extends IntegrationTestCase {
myRoot.refresh(false, true);
List<Change> changes = getVcs().getChangeListInTests().getChangesInTests().get(0).getChanges();
assertEquals(changes.toString(), 4, changes.size());
List<String> actual = new SmartList<String>();
for (Change each : changes) {
actual.add(((StructuralChange)each).getPath());