Bug 250125 createExistentResourceFromHandle forgets to create children resources
Problem: The method FolderDescription#createExistentResourceFromHandle(IResource,IProgressMonitor) checks if the folder already exists and returns immediately if so. In cases where the FolderDescription has members which are not existing at that moment, that members will not be created. Use case: Assume you want to create a folder and a file in that folder and use two operations for this. I know it is not necessary to use two operations but my configuration is more complex than this example code. IFolder folder = ... // must not exist CreateFolderOperation op1 = new CreateFolderOperation(folder,...); IFile file = folder.getFile(...); // must not exist CreateFileOperation op1 = new CreateFileOperation(file,...); op1.execute(...); op2.execute(...); The execution of the op2 does not create the file because as stated above createExistentResourceFromHandle returns immediately because the parent folder of the file was created by op1. IMHO createExistentResourceFromHandle must check if members of a FolderDescription should be created.
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/undo/CreateFolderOperation.java
/*******************************************************************************
 * Copyright (c) 2006, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.ide.undo;
import java.net.URI;
import org.eclipse.core.resources.IFolder;
import org.eclipse.ui.internal.ide.undo.ContainerDescription;
/**
 * A CreateFolderOperation represents an undoable operation for creating a
 * folder in the workspace. If a link location is specified, the folder is
 * considered to be linked to the specified location. If a link location is not
 * specified, the folder will be created in the location specified by the
 * handle, and the entire containment path of the folder will be created if it
 * does not exist. Clients may call the public API from a background thread.
 * 
 * This class is intended to be instantiated and used by clients. It is not
 * intended to be subclassed by clients.
 * 
 * @since 3.3
 * 
 */
public class CreateFolderOperation extends AbstractCreateResourcesOperation {