use of org.eclipse.che.api.vfs.VirtualFileVisitor in project che by eclipse.
the class LocalVirtualFileTest method getFileTreeAsList.
private List<VirtualFile> getFileTreeAsList(VirtualFile rootOfTree) throws Exception {
List<VirtualFile> list = newArrayList();
rootOfTree.accept(new VirtualFileVisitor() {
@Override
public void visit(VirtualFile virtualFile) throws ServerException {
list.add(virtualFile);
if (virtualFile.isFolder()) {
for (VirtualFile child : virtualFile.getChildren()) {
child.accept(this);
}
}
}
});
return list;
}
use of org.eclipse.che.api.vfs.VirtualFileVisitor in project che by eclipse.
the class MemoryVirtualFileTest method getFileTreeAsList.
private List<VirtualFile> getFileTreeAsList(VirtualFile rootOfTree) throws Exception {
List<VirtualFile> list = newArrayList();
rootOfTree.accept(new VirtualFileVisitor() {
@Override
public void visit(VirtualFile virtualFile) throws ServerException {
list.add(virtualFile);
if (virtualFile.isFolder()) {
for (VirtualFile child : virtualFile.getChildren()) {
child.accept(this);
}
}
}
});
return list;
}
use of org.eclipse.che.api.vfs.VirtualFileVisitor in project che by eclipse.
the class MemoryVirtualFileTest method acceptsVisitor.
@Test
public void acceptsVisitor() throws Exception {
VirtualFile root = getRoot();
boolean[] visitedFlag = new boolean[] { false };
VirtualFileVisitor visitor = virtualFile -> {
assertSame(root, virtualFile);
visitedFlag[0] = true;
};
root.accept(visitor);
assertTrue("visit(VirtualFile) method was not invoked", visitedFlag[0]);
}
use of org.eclipse.che.api.vfs.VirtualFileVisitor in project che by eclipse.
the class MemoryVirtualFile method getTreeAsList.
List<VirtualFile> getTreeAsList(VirtualFile folder) throws ServerException {
List<VirtualFile> list = newArrayList();
folder.accept(new VirtualFileVisitor() {
@Override
public void visit(VirtualFile virtualFile) throws ServerException {
if (virtualFile.isFolder()) {
for (VirtualFile child : virtualFile.getChildren()) {
child.accept(this);
}
}
list.add(virtualFile);
}
});
return list;
}
use of org.eclipse.che.api.vfs.VirtualFileVisitor in project che by eclipse.
the class LocalVirtualFileTest method acceptsVisitor.
@Test
public void acceptsVisitor() throws Exception {
VirtualFile root = getRoot();
boolean[] visitedFlag = new boolean[] { false };
VirtualFileVisitor visitor = virtualFile -> {
assertSame(root, virtualFile);
visitedFlag[0] = true;
};
root.accept(visitor);
assertTrue("visit(VirtualFile) method was not invoked", visitedFlag[0]);
}
Aggregations