/** Process all events for keys queued to the watcher */ private static void forwardToItopic(WatchEvent.Kind<Path> kind, Path dir) { boolean isDir = Files.isDirectory(dir); if (kind == ENTRY_CREATE) { if (!isDir) { Action act = new Action("add_file", Folder.getInternalPath(dir)); // Folder.getFileFromDiskToWinSafe(act.getPath()); Folder.loadFileFromFSToInternal(dir); topic.publish(act); } else { if (Folder.isEmptyFSFolder(dir)) { Folder.createEmptyFolderInInternal(dir); topic.publish(new Action("create_empty_folder", Folder.getInternalPath(dir))); } else { Folder.loadFolderFromFSToInternal(dir); topic.publish(new Action("create_folder", Folder.getInternalPath(dir))); } } } else if (kind == ENTRY_DELETE) { // todo Folder.deleteFromInternal(dir); topic.publish(new Action("delete_entry", Folder.getInternalPath(dir))); } else if (kind == ENTRY_MODIFY) { // todo if (!isDir) { Folder.loadFileFromFSToInternal(dir); topic.publish(new Action("edit_file", Folder.getInternalPath(dir))); } else { if (Folder.isEmptyFSFolder(dir)) { Folder.createEmptyFolderInInternal(dir); topic.publish(new Action("create_empty_folder", Folder.getInternalPath(dir))); } else { Folder.loadFolderFromFSToInternal(dir); topic.publish(new Action("edit_folder", Folder.getInternalPath(dir))); } } } else { // TODO System.out.println("[forwardToItopic] Unexpected Event - kind=" + kind + "dir=" + dir); } }