use of com.intellij.openapi.vfs.newvfs.persistent.RefreshWorker in project intellij-community by JetBrains.
the class RefreshSessionImpl method scan.
public void scan() {
List<VirtualFile> workQueue = myWorkQueue;
myWorkQueue = new ArrayList<>();
boolean haveEventsToFire = myFinishRunnable != null || !myEvents.isEmpty();
if (!workQueue.isEmpty()) {
LocalFileSystem fs = LocalFileSystem.getInstance();
if (fs instanceof LocalFileSystemImpl) {
((LocalFileSystemImpl) fs).markSuspiciousFilesDirty(workQueue);
}
long t = 0;
if (LOG.isTraceEnabled()) {
LOG.trace("scanning " + workQueue);
t = System.currentTimeMillis();
}
int count = 0;
refresh: do {
if (LOG.isTraceEnabled())
LOG.trace("try=" + count);
for (VirtualFile file : workQueue) {
if (myCancelled)
break refresh;
NewVirtualFile nvf = (NewVirtualFile) file;
if (!myIsRecursive && !myIsAsync) {
// always scan when non-recursive AND synchronous - needed e.g. when refreshing project files on open
nvf.markDirty();
}
RefreshWorker worker = new RefreshWorker(nvf, myIsRecursive);
myWorker = worker;
worker.scan();
haveEventsToFire |= myEvents.addAll(worker.getEvents());
}
count++;
if (LOG.isTraceEnabled())
LOG.trace("events=" + myEvents.size());
} while (!myCancelled && myIsRecursive && count < 3 && workQueue.stream().anyMatch(f -> ((NewVirtualFile) f).isDirty()));
if (t != 0) {
t = System.currentTimeMillis() - t;
LOG.trace((myCancelled ? "cancelled, " : "done, ") + t + " ms, events " + myEvents);
}
}
myWorker = null;
myHaveEventsToFire = haveEventsToFire;
}
use of com.intellij.openapi.vfs.newvfs.persistent.RefreshWorker in project intellij-community by JetBrains.
the class RefreshSessionImpl method cancel.
void cancel() {
myCancelled = true;
RefreshWorker worker = myWorker;
if (worker != null) {
worker.cancel();
}
}
Aggregations