fastForward = true;
startIndex = resources.indexOf(walkState.getCurrentResource());
}
for (int i = startIndex; i < resources.size(); i++) {
AbstractProfileResource resource = resources.get(i);
if (!fastForward) {
walkState.setCurrentResource(resource);
walkState.setCurrentFileWalker(null);
}
if (cancelled) {
break;
}
if (resource.isDirectory()) {
FileWalker fileWalker;
if (!fastForward) {
walkState.setCurrentFileWalker(new FileWalker(resource.getUri(), resource.isRecursive()));
}
fileWalker = walkState.getCurrentFileWalker();
fileWalker.setFileHandler(new FileWalkerHandler() {
@Override
public ResourceId handle(File file, int depth, ProgressEntry parent) {
progressMonitor.startJob(file.toURI());
ResourceId parentId = parent == null ? null : parent.getResourceId();
fileEventHandler.onEvent(file, parentId, null);
return null;
}
});
fileWalker.setDirectoryHandler(new FileWalkerHandler() {
@Override
public ResourceId handle(File file, int depth, ProgressEntry parent) {
progressMonitor.startJob(file.toURI());
ResourceId parentId = parent == null ? null : parent.getResourceId();
return directoryEventHandler.onEvent(file, parentId, depth, false);
}
});
fileWalker.setRestrictedDirectoryHandler(new FileWalkerHandler() {
@Override
public ResourceId handle(File file, int depth, ProgressEntry parent) {
progressMonitor.startJob(file.toURI());
ResourceId parentId = parent == null ? null : parent.getResourceId();
return directoryEventHandler.onEvent(file, parentId, depth, true);
}
});
walkState.setWalkStatus(WalkStatus.IN_PROGRESS);
fileWalker.walk();
} else {
progressMonitor.startJob(resource.getUri());
fileEventHandler.onEvent(new File(resource.getUri()), null, null);
}
fastForward = false;
}
walkState.setWalkStatus(WalkStatus.FINISHED);