use of com.intellij.openapi.vfs.impl.local.FileWatcher in project intellij-community by JetBrains.
the class StartupManagerImpl method checkProjectRoots.
private void checkProjectRoots() {
VirtualFile[] roots = ProjectRootManager.getInstance(myProject).getContentRoots();
if (roots.length == 0)
return;
LocalFileSystem fs = LocalFileSystem.getInstance();
if (!(fs instanceof LocalFileSystemImpl))
return;
FileWatcher watcher = ((LocalFileSystemImpl) fs).getFileWatcher();
if (!watcher.isOperational())
return;
PooledThreadExecutor.INSTANCE.submit(() -> {
LOG.debug("FW/roots waiting started");
while (true) {
if (myProject.isDisposed())
return;
if (!watcher.isSettingRoots())
break;
TimeoutUtil.sleep(10);
}
LOG.debug("FW/roots waiting finished");
Collection<String> manualWatchRoots = watcher.getManualWatchRoots();
if (!manualWatchRoots.isEmpty()) {
List<String> nonWatched = new SmartList<>();
for (VirtualFile root : roots) {
if (!(root.getFileSystem() instanceof LocalFileSystem))
continue;
String rootPath = root.getPath();
for (String manualWatchRoot : manualWatchRoots) {
if (FileUtil.isAncestor(manualWatchRoot, rootPath, false)) {
nonWatched.add(rootPath);
}
}
}
if (!nonWatched.isEmpty()) {
String message = ApplicationBundle.message("watcher.non.watchable.project");
watcher.notifyOnFailure(message, null);
LOG.info("unwatched roots: " + nonWatched);
LOG.info("manual watches: " + manualWatchRoots);
}
}
});
}
Aggregations