Search in sources :

Example 1 with FileWatcherNotificationListener

use of org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationListener in project che by eclipse.

the class ProjectManager method initWatcher.

void initWatcher() throws IOException {
    FileWatcherNotificationListener defaultListener = new FileWatcherNotificationListener(file -> !(file.getPath().toString().contains(".che") || file.getPath().toString().contains(".#"))) {

        @Override
        public void onFileWatcherEvent(VirtualFile virtualFile, FileWatcherEventType eventType) {
            LOG.debug("FS event detected: " + eventType + " " + virtualFile.getPath().toString() + " " + virtualFile.isFile());
        }
    };
    fileWatchNotifier.addNotificationListener(defaultListener);
    try {
        fileWatcher.startup();
    } catch (IOException e) {
        LOG.error(e.getMessage(), e);
        fileWatchNotifier.removeNotificationListener(defaultListener);
    }
}
Also used : VirtualFile(org.eclipse.che.api.vfs.VirtualFile) FileWatcherNotificationListener(org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationListener) FileWatcherEventType(org.eclipse.che.api.project.shared.dto.event.FileWatcherEventType) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 FileWatcherEventType (org.eclipse.che.api.project.shared.dto.event.FileWatcherEventType)1 VirtualFile (org.eclipse.che.api.vfs.VirtualFile)1 FileWatcherNotificationListener (org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationListener)1