private boolean handleWatchEvent(final boolean registerWatchKey, final WatchEventItem item) throws IOException {

		final WatchEvent event = item.getEvent();
		final Path root        = item.getRoot();
		final Path parent      = item.getPath();
		boolean result         = true; // default is "don't cancel watch key"

		try (final Tx tx = StructrApp.getInstance().tx()) {

			final Path path = parent.resolve((Path)event.context());
			final Kind kind = event.kind();

			if (StandardWatchEventKinds.ENTRY_CREATE.equals(kind)) {

				if (Files.isDirectory(path)) {

					scanDirectoryTree(registerWatchKey, root, path);
				}

				result = listener.onCreate(root, parent, path);

			} else if (StandardWatchEventKinds.ENTRY_DELETE.equals(kind)) {

				result = listener.onDelete(root, parent, path);

			} else if (StandardWatchEventKinds.ENTRY_MODIFY.equals(kind)) {

				result = listener.onModify(root, parent, path);
			}

			tx.success();

		} catch (FrameworkException fex) {
			fex.printStackTrace();
		}

		return result;
	}
private boolean handleWatchEvent ( final boolean registerWatchKey , final WatchEventItem item ) throws IOException { final WatchEvent event = item . getEvent ( ) ; final Path root = item . getRoot ( ) ; final Path parent = item . getPath ( ) ; boolean result = true ; try ( final Tx tx = StructrApp . getInstance ( ) . tx ( ) ) { final Path path = parent . resolve ( ( Path ) event . context ( ) ) ; final Kind kind = event . kind ( ) ; if ( StandardWatchEventKinds . ENTRY_CREATE . equals ( kind ) ) { if ( Files . isDirectory ( path ) ) { scanDirectoryTree ( registerWatchKey , root , path ) ; } result = listener . onCreate ( root , parent , path ) ; } else if ( StandardWatchEventKinds . ENTRY_DELETE . equals ( kind ) ) { result = listener . onDelete ( root , parent , path ) ; } else if ( StandardWatchEventKinds . ENTRY_MODIFY . equals ( kind ) ) { result = listener . onModify ( root , parent , path ) ; } tx . success ( ) ; } catch ( FrameworkException fex ) { fex . printStackTrace ( ) ; } return result ; }
----- private methods -----