// TODO: Figure out if we are pasting on top of files that already
// exist with the same name. If we do, we need to handle that via a prompted
// replace.
Mutation.Type mutationType = copiedNodesAreCut ? Mutation.Type.MOVE : Mutation.Type.COPY;
WorkspaceTreeUpdate msg = fileTreeModel.makeEmptyTreeUpdate();
for (int i = 0, n = copiedNodes.size(); i < n; i++) {
FileTreeNode copiedNode = copiedNodes.get(i);
PathUtil targetPath = new PathUtil.Builder().addPath(parentDirData.getNodePath())
.addPathComponent(FileTreeUtils.allocateName(
parentDirData.<DirInfoImpl>cast(), copiedNode.getName())).build();
msg.getMutations().add(FileTreeUtils.makeMutation(
mutationType, copiedNode.getNodePath(), targetPath, copiedNode.isDirectory(),
copiedNode.getFileEditSessionKey()));
}
// Cut nodes can only be pasted once.