public void execute() // ------------- // ------------- { // --------- Folder source = from.val(); if (source.selected.size() == 0) { throw new CommandPreconditionsException("Select item to move!"); } Folder dest = to.val(); if (source.equals(dest)) { throw new CommandPreconditionsException("Select different folders."); } for (Document d : source.selected.read()) { if (d instanceof Folder) if (((Folder) d).isParent(dest)) throw new CommandPreconditionsException("Destination folder is subfolder!"); } source.move(dest); // --------- }